C# Класс Ms.Azure.Logging.Helpers.LoggingHelper

Helper class to initialize logging for Azure webroles, workerroles and webapplications
This class is meant to make it as easy as possible to enable logging, using just a few statements. Some defaults are chosen that might not fit all situations, such as a TransferInterval on the TableStorageAppender of 5 minutes.
Показать файл Открыть проект

Открытые методы

Метод Описание
ClearAllLoggers ( ) : void

Clear all existing appenders and loggers

FlushAppenders ( ) : void

Flush any appenders that we know to support flushing. Typically used to flush the TableStorageAppender just before the application shuts down.

InitializeAzureTableLogging ( CloudStorageAccount storageAccount, string customTable = null, log4net.Core.Level logLevel = null ) : void

Initializes log4net with azure table logging.

InitializeAzureTableLogging ( StorageCredentials credentials, string customTable = null, log4net.Core.Level logLevel = null ) : void

Initializes log4net with azure table logging.

InitializeFileLogging ( string logfile, log4net.Core.Level logLevel = null ) : void

Initializes log4net with file logging.

InitializeFromConfiguration ( NameValueCollection config ) : void

Initializes logging from configuration. The NameValueCollection will read the following properties: - LogType: TableStorage or File - LogStorageName: account name for the storage account - LogStorageKey: key for the storage account - LogStorageTable: optional, customize the table to log to - LogFile: Filename to log to - LogStorageString: use a connection string to indicate storage account and credentials (makes LogStorageName and LogStorageKey obsolete and has preference)

Приватные методы

Метод Описание
DetermineLevel ( string level ) : log4net.Core.Level

Converts a string loglevel to the correct type in order to configure an appender

Things would be so much easier and flexible if they would've made it an Enum or some collection

Описание методов

ClearAllLoggers() публичный статический Метод

Clear all existing appenders and loggers
public static ClearAllLoggers ( ) : void
Результат void

FlushAppenders() публичный статический Метод

Flush any appenders that we know to support flushing. Typically used to flush the TableStorageAppender just before the application shuts down.
public static FlushAppenders ( ) : void
Результат void

InitializeAzureTableLogging() публичный статический Метод

Initializes log4net with azure table logging.
public static InitializeAzureTableLogging ( CloudStorageAccount storageAccount, string customTable = null, log4net.Core.Level logLevel = null ) : void
storageAccount CloudStorageAccount
customTable string
logLevel log4net.Core.Level
Результат void

InitializeAzureTableLogging() публичный статический Метод

Initializes log4net with azure table logging.
public static InitializeAzureTableLogging ( StorageCredentials credentials, string customTable = null, log4net.Core.Level logLevel = null ) : void
credentials StorageCredentials
customTable string
logLevel log4net.Core.Level
Результат void

InitializeFileLogging() публичный статический Метод

Initializes log4net with file logging.
public static InitializeFileLogging ( string logfile, log4net.Core.Level logLevel = null ) : void
logfile string
logLevel log4net.Core.Level
Результат void

InitializeFromConfiguration() публичный статический Метод

Initializes logging from configuration. The NameValueCollection will read the following properties: - LogType: TableStorage or File - LogStorageName: account name for the storage account - LogStorageKey: key for the storage account - LogStorageTable: optional, customize the table to log to - LogFile: Filename to log to - LogStorageString: use a connection string to indicate storage account and credentials (makes LogStorageName and LogStorageKey obsolete and has preference)
public static InitializeFromConfiguration ( NameValueCollection config ) : void
config System.Collections.Specialized.NameValueCollection
Результат void