C# Class BF2Statistics.Logging.LogWriter

Provides an object wrapper for a file that is used to store LogMessage's into. Uses a Multi-Thread safe Queueing system, and provides full Asynchronous writing and flushing
Inheritance: IDisposable
Afficher le fichier Open project: BF2Statistics/ControlCenter Class Usage Examples

Méthodes publiques

Свойство Type Description
LoggingEnabled bool

Méthodes publiques

Méthode Description
ClearLog ( ) : void

Queues the underlying log writer to empty the logfile before appending any more messages to it. Messages that are awaiting to be written to the log file are NOT removed from Queue

Dispose ( ) : void
LogWriter ( string FileLocation, bool Truncate = false, int TruncateLen = 2097152 ) : System

Creates a new Log Writter instance

Write ( string message ) : void

Adds a message to the queue, to be written to the log file

Private Methods

Méthode Description
FlushLog ( ) : void

Flushes the Queue to the physical log file

Method Details

ClearLog() public méthode

Queues the underlying log writer to empty the logfile before appending any more messages to it. Messages that are awaiting to be written to the log file are NOT removed from Queue
public ClearLog ( ) : void
Résultat void

Dispose() public méthode

public Dispose ( ) : void
Résultat void

LogWriter() public méthode

Creates a new Log Writter instance
public LogWriter ( string FileLocation, bool Truncate = false, int TruncateLen = 2097152 ) : System
FileLocation string The location of the logfile. If the file doesnt exist, /// It will be created.
Truncate bool If set to true and the logfile is over XX size, it will be truncated to 0 length
TruncateLen int /// If is true, The size of the file must be at least this size, /// in bytes, to truncate it ///
Résultat System

Write() public méthode

Adds a message to the queue, to be written to the log file
public Write ( string message ) : void
message string The message to write to the log
Résultat void

Property Details

LoggingEnabled public_oe property

Gets or sets whether we having logging enabled. If disabled, all invokes to Write() will be ignored
public bool LoggingEnabled
Résultat bool