JayKay.AspNetCore.Logging.Email
1.0.0
dotnet add package JayKay.AspNetCore.Logging.Email --version 1.0.0
NuGet\Install-Package JayKay.AspNetCore.Logging.Email -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JayKay.AspNetCore.Logging.Email" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JayKay.AspNetCore.Logging.Email --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: JayKay.AspNetCore.Logging.Email, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install JayKay.AspNetCore.Logging.Email as a Cake Addin #addin nuget:?package=JayKay.AspNetCore.Logging.Email&version=1.0.0 // Install JayKay.AspNetCore.Logging.Email as a Cake Tool #tool nuget:?package=JayKay.AspNetCore.Logging.Email&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AspNetCore Logging to email
This package adds the ability so send log message to an email address.
Features
- Log messages are queued until a threshold is met
- Amount of messages
- Time passed
- Messages are sent with a background task (Hosted Service)
Setup
In your AspNetCore setup add:
using JayKay.AspNetCore.Logging.Email;
public class Program
{
public static void Main(string[] args)
{
...
var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddEmailLogger();
...
}
}
Cofiguration
In your appsettings.json add:
{
"Logging": {
...
"Email": {
"SmtpHost": "[the SMTP host]",
"UserName": "[the SMTP user name]",
"Password": "[the SMTP password]",
"From": "[from address]",
"To": [ "[to address]", ... ],
"EmailSubject": "[The email subject]",
"LogLevel": {
"Default": ...
}
}
}
...
or in your App startup:
builder.Logging.AddEmailLogger(config =>
{
config.EmailSubject = "Error log";
...
});
- PollInterval: Number of seconds to check for new log messages (default: 10)
- MaxMessagesPerMail: Maximum messages per email (default: 50)
- MaxQueueSize: Maximum messages which can be queued until an email is sent synchronously (default: 1024)
- SmtpHost: SMTP server host
- SmtpPort: SMTP server port (default:587)
- SmtpUseSSL: COnnect with SSL/TLS connection (default: false)
- UserName: User name to connect to SMTP server
- Password: Password to connect to SMTP server
- From: Email address to send messages from
- To: List of email addresses to send messages to
- EmailSubject: Email subject line
SmtpHost, UserName, Password, From and at least one non-empty entry in To must be set for the logger to be active.
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 508 | 2/12/2023 |