Class LoggerConfigExtensions
Inheritance
Namespace: Umbraco.Extensions
Assembly: Umbraco.Infrastructure.dll
Syntax
public static class LoggerConfigExtensions
Methods
View SourceMinimalConfiguration(LoggerConfiguration, IHostEnvironment, ILoggingConfiguration, UmbracoFileConfiguration)
This configures Serilog with some defaults Such as adding ProcessID, Thread, AppDomain etc It is highly recommended that you keep/use this default in your own logging config customizations
Declaration
public static LoggerConfiguration MinimalConfiguration(this LoggerConfiguration logConfig, IHostEnvironment hostEnvironment, ILoggingConfiguration loggingConfiguration, UmbracoFileConfiguration umbracoFileConfiguration)
Parameters
Type | Name | Description |
---|---|---|
LoggerConfiguration | logConfig | |
IHostEnvironment | hostEnvironment | |
ILoggingConfiguration | loggingConfiguration | |
UmbracoFileConfiguration | umbracoFileConfiguration |
Returns
Type | Description |
---|---|
LoggerConfiguration |
MinimalConfiguration(LoggerConfiguration, IHostingEnvironment, ILoggingConfiguration, IConfiguration)
This configures Serilog with some defaults Such as adding ProcessID, Thread, AppDomain etc It is highly recommended that you keep/use this default in your own logging config customizations
Declaration
public static LoggerConfiguration MinimalConfiguration(this LoggerConfiguration logConfig, IHostingEnvironment hostingEnvironment, ILoggingConfiguration loggingConfiguration, IConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
LoggerConfiguration | logConfig | |
IHostingEnvironment | hostingEnvironment | |
ILoggingConfiguration | loggingConfiguration | |
IConfiguration | configuration |
Returns
Type | Description |
---|---|
LoggerConfiguration |
MinimalConfiguration(LoggerConfiguration, IHostingEnvironment, ILoggingConfiguration, IConfiguration, out UmbracoFileConfiguration)
This configures Serilog with some defaults Such as adding ProcessID, Thread, AppDomain etc It is highly recommended that you keep/use this default in your own logging config customizations
Declaration
public static LoggerConfiguration MinimalConfiguration(this LoggerConfiguration logConfig, IHostingEnvironment hostingEnvironment, ILoggingConfiguration loggingConfiguration, IConfiguration configuration, out UmbracoFileConfiguration umbFileConfiguration)
Parameters
Type | Name | Description |
---|---|---|
LoggerConfiguration | logConfig | |
IHostingEnvironment | hostingEnvironment | |
ILoggingConfiguration | loggingConfiguration | |
IConfiguration | configuration | |
UmbracoFileConfiguration | umbFileConfiguration |
Returns
Type | Description |
---|---|
LoggerConfiguration |
OutputDefaultJsonFile(LoggerConfiguration, IHostEnvironment, LoggingSettings, LogEventLevel, Nullable<Int32>)
Outputs a CLEF format JSON log at /App_Data/Logs/
Declaration
public static LoggerConfiguration OutputDefaultJsonFile(this LoggerConfiguration logConfig, IHostEnvironment hostEnvironment, LoggingSettings loggingSettings, LogEventLevel minimumLevel = null, int? retainedFileCount = null)
Parameters
Type | Name | Description |
---|---|---|
LoggerConfiguration | logConfig | A Serilog LoggerConfiguration |
IHostEnvironment | hostEnvironment | |
LoggingSettings | loggingSettings | The logging configuration |
LogEventLevel | minimumLevel | The log level you wish the JSON file to collect - default is Verbose (highest) |
System.Nullable<System.Int32> | retainedFileCount | The number of days to keep log files. Default is set to null which means all logs are kept |
Returns
Type | Description |
---|---|
LoggerConfiguration |
OutputDefaultJsonFile(LoggerConfiguration, IHostingEnvironment, ILoggingConfiguration, LogEventLevel, Nullable<Int32>)
Outputs a CLEF format JSON log at /App_Data/Logs/
Declaration
public static LoggerConfiguration OutputDefaultJsonFile(this LoggerConfiguration logConfig, IHostingEnvironment hostingEnvironment, ILoggingConfiguration loggingConfiguration, LogEventLevel minimumLevel = null, int? retainedFileCount = null)
Parameters
Type | Name | Description |
---|---|---|
LoggerConfiguration | logConfig | A Serilog LoggerConfiguration |
IHostingEnvironment | hostingEnvironment | |
ILoggingConfiguration | loggingConfiguration | The logging configuration |
LogEventLevel | minimumLevel | The log level you wish the JSON file to collect - default is Verbose (highest) |
System.Nullable<System.Int32> | retainedFileCount | The number of days to keep log files. Default is set to null which means all logs are kept |
Returns
Type | Description |
---|---|
LoggerConfiguration |
OutputDefaultTextFile(LoggerConfiguration, IHostEnvironment, LoggingSettings, LogEventLevel)
Outputs a .txt format log at /App_Data/Logs/
Declaration
public static LoggerConfiguration OutputDefaultTextFile(this LoggerConfiguration logConfig, IHostEnvironment hostEnvironment, LoggingSettings loggingSettings, LogEventLevel minimumLevel = null)
Parameters
Type | Name | Description |
---|---|---|
LoggerConfiguration | logConfig | A Serilog LoggerConfiguration |
IHostEnvironment | hostEnvironment | |
LoggingSettings | loggingSettings | |
LogEventLevel | minimumLevel | The log level you wish the JSON file to collect - default is Verbose (highest) |
Returns
Type | Description |
---|---|
LoggerConfiguration |
OutputDefaultTextFile(LoggerConfiguration, IHostingEnvironment, LogEventLevel)
Outputs a .txt format log at /App_Data/Logs/
Declaration
public static LoggerConfiguration OutputDefaultTextFile(this LoggerConfiguration logConfig, IHostingEnvironment hostingEnvironment, LogEventLevel minimumLevel = null)
Parameters
Type | Name | Description |
---|---|---|
LoggerConfiguration | logConfig | A Serilog LoggerConfiguration |
IHostingEnvironment | hostingEnvironment | |
LogEventLevel | minimumLevel | The log level you wish the JSON file to collect - default is Verbose (highest) |
Returns
Type | Description |
---|---|
LoggerConfiguration |
UmbracoFile(LoggerSinkConfiguration, String, Nullable<ITextFormatter>, LogEventLevel, Nullable<LoggingLevelSwitch>, Nullable<Int64>, Nullable<TimeSpan>, RollingInterval, Boolean, Nullable<Int32>, Encoding)
Declaration
public static LoggerConfiguration UmbracoFile(this LoggerSinkConfiguration configuration, string path, ITextFormatter? formatter = null, LogEventLevel restrictedToMinimumLevel = null, LoggingLevelSwitch? levelSwitch = null, long? fileSizeLimitBytes = 1073741824L, TimeSpan? flushToDiskInterval = null, RollingInterval rollingInterval = null, bool rollOnFileSizeLimit = false, int? retainedFileCountLimit = 31, Encoding encoding = null)
Parameters
Type | Name | Description |
---|---|---|
LoggerSinkConfiguration | configuration | |
System.String | path | |
System.Nullable<ITextFormatter> | formatter | |
LogEventLevel | restrictedToMinimumLevel | |
System.Nullable<LoggingLevelSwitch> | levelSwitch | |
System.Nullable<System.Int64> | fileSizeLimitBytes | |
System.Nullable<TimeSpan> | flushToDiskInterval | |
RollingInterval | rollingInterval | |
System.Boolean | rollOnFileSizeLimit | |
System.Nullable<System.Int32> | retainedFileCountLimit | |
System.Text.Encoding | encoding |
Returns
Type | Description |
---|---|
LoggerConfiguration |
Remarks
Used in config - If renamed or moved to other assembly the config file also has be updated.