Class LoggerFile
Logging into file
Inheritance
Implements
Namespace: BuildSystem.Loggers
Assembly: BuildSystem.Loggers.dll
Syntax
public class LoggerFile : Object, ILogger
Constructors
LoggerFile(string, string, Nullable<int>, string)
Logging into file
Declaration
public LoggerFile(string logFolder, string fileNameSuffix, Nullable<int> maxLogsCount, string template = "{TIME} | [{LEVEL}] | {MESSAGE}")
Parameters
Type | Name | Description |
---|---|---|
string | logFolder | Folder with logs |
string | fileNameSuffix | String, which be the first part of file name with log |
System.Nullable<><int> | maxLogsCount | Maximum count of logs in folder. When creating new log file, we control that count of log files with BuildSystem.Loggers.LoggerFile._fileNameSuffix does not exceed this value. Null if we don't need to control count of logs |
string | template | Template for log message. Example: "{TIME} [{LEVEL}] {MESSAGE}". Time will be replaced with current time in format "yyyy-MM-dd HH:mm:ss.fff" (fff - milliseconds), level will be replaced with log level, message will be replaced with log message |
Methods
addLogLevel(LogLevel)
Add logging for new level
Declaration
public void addLogLevel(LogLevel level)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | level |
debug(string)
Save message in log with level = debug
Declaration
public void debug(string data)
Parameters
Type | Name | Description |
---|---|---|
string | data |
error(string)
Save message in log with level = error
Declaration
public void error(string data)
Parameters
Type | Name | Description |
---|---|---|
string | data |
head(string)
Save message in log with level = head
Declaration
public void head(string data)
Parameters
Type | Name | Description |
---|---|---|
string | data |
info(string)
Save message in log with level = info
Declaration
public void info(string data)
Parameters
Type | Name | Description |
---|---|---|
string | data |
log(LogLevel, string)
Save message with its level to log
Declaration
public void log(LogLevel level, string data)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | level | |
string | data |
removeLogLevel(LogLevel)
Remove logging for existing level
Declaration
public void removeLogLevel(LogLevel level)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | level |
setMinLevel(LogLevel)
Minimal level of logging, which will be processed. All higher levels will also be added
Declaration
public void setMinLevel(LogLevel minLevel)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | minLevel |
verbose(string)
Save message in log with level = verbose
Declaration
public void verbose(string data)
Parameters
Type | Name | Description |
---|---|---|
string | data |
warning(string)
Save message in log with level = warning
Declaration
public void warning(string data)
Parameters
Type | Name | Description |
---|---|---|
string | data |