C# Class WebApplications.Utilities.Logging.Loggers.FileLogger

Inheritance: LoggerBase
ファイルを表示 Open project: webappsuk/CoreLibraries

Private Properties

Property Type Description
FileLogger System
ValidatePathFormat FormatBuilder

Public Methods

Method Description
Add ( IEnumerable logs, CancellationToken token = default(CancellationToken) ) : Task

Adds the specified logs to storage in batches.

CloseFile ( ) : void

Closes the current log file.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

FileLogger ( [ name, [ directory = null, System.Int64 maxLog = 1000, System.TimeSpan maxDuration = default(TimeSpan), LoggingLevels validLevels = LoggingLevels.All, [ format = null, [ fileNameFormat = null, [ extension = null, uint buffer = 65536, bool autoFlush = false ) : System

Initializes a new instance of the FileLogger class.

Flush ( CancellationToken token = default(CancellationToken) ) : Task

Force a flush of this logger.

Private Methods

Method Description
FileLogger ( ) : System

Initializes static members of the FileLogger class.

ValidatePathFormat ( [ directory, [ fileNameFormat, [ extension, [ format ) : FormatBuilder

Method Details

Add() public method

Adds the specified logs to storage in batches.
public Add ( IEnumerable logs, CancellationToken token = default(CancellationToken) ) : Task
logs IEnumerable The logs to add to storage.
token System.Threading.CancellationToken The token.
return Task

CloseFile() public method

Closes the current log file.
public CloseFile ( ) : void
return void

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

FileLogger() public method

Initializes a new instance of the FileLogger class.
/// was less than 10, which would result in too many log files to be created. /// -or- /// /// was less than 10 seconds, which would result in too many log files to be created. /// -or- /// /// was either null or whitespace. /// -or- /// The string was either null or whitespace. /// -or- /// An error occurred trying to access the . /// -or- /// /// was more than 5 characters long. /// -or- /// The led to an invalid path or created a path that references the wrong . /// -or- /// File path contained invalid characters.
public FileLogger ( [ name, [ directory = null, System.Int64 maxLog = 1000, System.TimeSpan maxDuration = default(TimeSpan), LoggingLevels validLevels = LoggingLevels.All, [ format = null, [ fileNameFormat = null, [ extension = null, uint buffer = 65536, bool autoFlush = false ) : System
name [ The filename.
directory [ The directory to log to (default to entry assembly directory).
maxLog System.Int64 The maximum number of log items in a single log file. /// By default this is set to 1,000.
maxDuration System.TimeSpan The maximum time period that a single log file can cover.
validLevels LoggingLevels The valid log levels. /// By default allows all log levels.
format [ The log format (default to "Verbose,Xml").
fileNameFormat [ The filename format - where {DateTime} is the creation date time. /// By default the format is "{ApplicationName}-{DateTime:yyMMddHHmmssffff}".
extension [ The file extension. /// By default this is set to use "log".
buffer uint The buffer.
autoFlush bool if set to [auto flush].
return System

Flush() public method

Force a flush of this logger.
public Flush ( CancellationToken token = default(CancellationToken) ) : Task
token System.Threading.CancellationToken
return Task