C# Класс CK.Monitoring.MonitorFileOutputBase

Helper class that encapsulates temporary stream and final renaming for log entries streams. This currently handles only the maximum count of entries per file but this may be extended with options like "SubFolderMode" that can be based on current time (to group logs inside timed intermediate folders like one per day: 2014/01/12 or 2014-01/12, etc.).
Наследование: IDisposable
Показать файл Открыть проект

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

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

Closes the file if it is currently opened. Does nothing otherwise.

Dispose ( ) : void

Simply calls Close.

Initialize ( IActivityMonitor monitor ) : bool

Checks whether this MonitorFileOutputBase is valid: its base path is successfully created. Can be called multiple times.

Защищенные методы

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

This method must be called after write: it closes and produces the final file if the current file is full.

BeforeWrite ( ) : void

This method must be called before any write: it calls OpenNewFile if needed.

CloseCurrentFile ( ) : void

Closes the currently opended file.

MonitorFileOutputBase ( string configuredPath, System.Guid monitorId, int maxCountPerFile, bool useGzipCompression ) : System

Initializes a new file for ILogEntry issued from a specific monitor: the final file name is based on FileUtil.FileNameUniqueTimeUtcFormat with a "-{XXX...XXX}.ckmon" suffix where {XXX...XXX} is the unique identifier (Guid with the B format - 32 digits separated by hyphens, enclosed in braces) of the monitor. You must call Initialize before actually using this object.

MonitorFileOutputBase ( string configuredPath, string fileNameSuffix, int maxCountPerFile, bool useGzipCompression ) : System

Initializes a new file for IMulticastLogEntry: the final file name is based on FileUtil.FileNameUniqueTimeUtcFormat with a ".ckmon" extension. You must call Initialize before actually using this object.

OpenNewFile ( ) : Stream

Opens a new file suffixed by ".tmp".

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

Метод Описание
ComputeBasePath ( IActivityMonitor m ) : string

Computes the root path.

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

AfterWrite() защищенный Метод

This method must be called after write: it closes and produces the final file if the current file is full.
protected AfterWrite ( ) : void
Результат void

BeforeWrite() защищенный Метод

This method must be called before any write: it calls OpenNewFile if needed.
protected BeforeWrite ( ) : void
Результат void

Close() публичный Метод

Closes the file if it is currently opened. Does nothing otherwise.
public Close ( ) : void
Результат void

CloseCurrentFile() защищенный Метод

Closes the currently opended file.
protected CloseCurrentFile ( ) : void
Результат void

Dispose() публичный Метод

Simply calls Close.
public Dispose ( ) : void
Результат void

Initialize() публичный Метод

Checks whether this MonitorFileOutputBase is valid: its base path is successfully created. Can be called multiple times.
public Initialize ( IActivityMonitor monitor ) : bool
monitor IActivityMonitor Required monitor.
Результат bool

MonitorFileOutputBase() защищенный Метод

Initializes a new file for ILogEntry issued from a specific monitor: the final file name is based on FileUtil.FileNameUniqueTimeUtcFormat with a "-{XXX...XXX}.ckmon" suffix where {XXX...XXX} is the unique identifier (Guid with the B format - 32 digits separated by hyphens, enclosed in braces) of the monitor. You must call Initialize before actually using this object.
protected MonitorFileOutputBase ( string configuredPath, System.Guid monitorId, int maxCountPerFile, bool useGzipCompression ) : System
configuredPath string The path. Can be absolute. When relative, it will be under that must be set.
monitorId System.Guid Monitor identifier.
maxCountPerFile int Maximum number of entries per file. Must be greater than 1.
useGzipCompression bool True to gzip the file.
Результат System

MonitorFileOutputBase() защищенный Метод

Initializes a new file for IMulticastLogEntry: the final file name is based on FileUtil.FileNameUniqueTimeUtcFormat with a ".ckmon" extension. You must call Initialize before actually using this object.
protected MonitorFileOutputBase ( string configuredPath, string fileNameSuffix, int maxCountPerFile, bool useGzipCompression ) : System
configuredPath string The path: it can be absolute and when relative, it will be under (that must be set).
fileNameSuffix string Suffix of the file including its extension. Must not be null nor empty.
maxCountPerFile int Maximum number of entries per file. Must be greater than 1.
useGzipCompression bool True to gzip the file.
Результат System

OpenNewFile() защищенный Метод

Opens a new file suffixed by ".tmp".
protected OpenNewFile ( ) : Stream
Результат Stream