C# Class NLog.Internal.FileAppenders.FileAppenderCache

Maintains a collection of file appenders usually associated with file targets.
Datei anzeigen Open project: NLog/NLog Class Usage Examples

Public Properties

Property Type Description
Empty FileAppenderCache

Public Methods

Method Description
AllocateAppender ( string fileName ) : BaseFileAppender

It allocates the first slot in the list when the file name does not already in the list and clean up any unused slots.

CloseAppenders ( ) : void

Close all the allocated appenders.

CloseAppenders ( System.DateTime expireTime ) : void

Close the allocated appenders initialised before the supplied time.

Dispose ( ) : void
FileAppenderCache ( int size, IFileAppenderFactory appenderFactory, ICreateFileParameters createFileParams ) : System

Initializes a new instance of the FileAppenderCache class.

The size of the list should be positive. No validations are performed during initialisation as it is an intenal class.

FlushAppenders ( ) : void

Fluch all the allocated appenders.

GetArchiveMutex ( string fileName ) : Mutex
GetFileCreationTimeUtc ( string filePath, bool fallback ) : DateTime?
GetFileLastWriteTimeUtc ( string filePath, bool fallback ) : DateTime?
GetFileLength ( string filePath, bool fallback ) : long?
InvalidateAppender ( string filePath ) : void

Closes the specified appender and removes it from the list.

InvalidateAppendersForInvalidFiles ( ) : void

Invalidates appenders for all files that were archived.

Private Methods

Method Description
CloseAppender ( BaseFileAppender appender ) : void
ExternalFileArchivingWatcher_OnFileChanged ( object sender, FileSystemEventArgs e ) : void
FileAppenderCache ( ) : System

Initializes a new "empty" instance of the FileAppenderCache class with zero size and empty list of appenders.

GetAppender ( string fileName ) : BaseFileAppender

Method Details

AllocateAppender() public method

It allocates the first slot in the list when the file name does not already in the list and clean up any unused slots.
/// Thrown when is called on an Empty instance. ///
public AllocateAppender ( string fileName ) : BaseFileAppender
fileName string File name associated with a single appender.
return BaseFileAppender

CloseAppenders() public method

Close all the allocated appenders.
public CloseAppenders ( ) : void
return void

CloseAppenders() public method

Close the allocated appenders initialised before the supplied time.
public CloseAppenders ( System.DateTime expireTime ) : void
expireTime System.DateTime The time which prior the appenders considered expired
return void

Dispose() public method

public Dispose ( ) : void
return void

FileAppenderCache() public method

Initializes a new instance of the FileAppenderCache class.
The size of the list should be positive. No validations are performed during initialisation as it is an intenal class.
public FileAppenderCache ( int size, IFileAppenderFactory appenderFactory, ICreateFileParameters createFileParams ) : System
size int Total number of appenders allowed in list.
appenderFactory IFileAppenderFactory Factory used to create each appender.
createFileParams ICreateFileParameters Parameters used for creating a file.
return System

FlushAppenders() public method

Fluch all the allocated appenders.
public FlushAppenders ( ) : void
return void

GetArchiveMutex() public method

public GetArchiveMutex ( string fileName ) : Mutex
fileName string
return Mutex

GetFileCreationTimeUtc() public method

public GetFileCreationTimeUtc ( string filePath, bool fallback ) : DateTime?
filePath string
fallback bool
return DateTime?

GetFileLastWriteTimeUtc() public method

public GetFileLastWriteTimeUtc ( string filePath, bool fallback ) : DateTime?
filePath string
fallback bool
return DateTime?

GetFileLength() public method

public GetFileLength ( string filePath, bool fallback ) : long?
filePath string
fallback bool
return long?

InvalidateAppender() public method

Closes the specified appender and removes it from the list.
public InvalidateAppender ( string filePath ) : void
filePath string File name of the appender to be closed.
return void

InvalidateAppendersForInvalidFiles() public method

Invalidates appenders for all files that were archived.
public InvalidateAppendersForInvalidFiles ( ) : void
return void

Property Details

Empty public_oe static_oe property

An "empty" instance of the FileAppenderCache class with zero size and empty list of appenders.
public static FileAppenderCache,NLog.Internal.FileAppenders Empty
return FileAppenderCache