An implementation of the ILogMessageHandler interface that writes log messages to a file.
sealed class
|
FileMessageHandler
|
extends
|
FormattedMessageHandler
|
When adding to a log message source, an instance of FileMessageHandler is redundant if another instance of FileMessageHandler using the same file path is already present in the source.
The log message format.
public
property
|
Format
{
get
}
|
||
type
|
ILogMessageFormat
|
||
value
|
|
The log message format object. | |
inherited
|
FormattedMessageHandler.Format
|
Creates a new instance of FileMessageHandler.
public
constructor
|
FileMessageHandler
(Path filePath,
ILogMessageFormat format = null,
int32 columns = 100,
bool append = true,
CharacterEncoding encoding = null,
LineEnding lineEnding = LineEnding.Native)
|
||
params
|
filePath
|
[not-null]
|
Path to the log file. |
format
|
The
log
message
format
to
use.
If
null ,
the
Default
format
will
be
used.
Defaults
to
null .
|
||
columns
|
[>=0]
|
Number
of
columns
to
use
for
right-alignment
of
formatted
log
messages.
Defaults
to
100 .
|
|
append
|
true
to
append
new
log
message
to
an
existing
log
file,
false
to
overwrite
an
existing
log
file.
Defaults
to
true .
|
||
encoding
|
The
character
encoding
to
use.
If
null ,
ISO_8859_1
will
be
used.
Defaults
to
null .
|
||
lineEnding
|
The line ending to use. Defaults to Native. |
Handles the given log message.
public
override
method
|
HandleLogMessage
(ILogger source,
LogSeverity logSeverity,
string logMessage)
|
||
params
|
source
|
[not-null]
|
The ILogger that has been used to emit the log message. |
logSeverity
|
The LogSeverity of the log message. | ||
logMessage
|
[not-null]
|
The log message | |
inherited
|
FormattedMessageHandler.HandleLogMessage
|
Remarks:
All exceptions that are thrown by implementing methods are dropped silently.
Checks if this log message handler is redundant if the given one is already present.
public
override
method
|
IsRedundant
(ILogMessageHandler other)
|
||
type
|
bool
|
||
params
|
other
|
[not-null]
|
The other handler. |
returns
|
true
if
this
log
message
handler
is
redundant,
false
if
not.
|
||
overrides
|
FormattedMessageHandler.IsRedundant
|
Changes the maximum log severity of this handler.
public
virtual
method
|
Severity
(LogSeverity severity)
|
||
type
|
ILogMessageHandler
|
||
params
|
severity
|
The new maximum log severity. | |
returns
|
|
The resulting log message handler. | |
inherited
|
LogMessageHandler.Severity
|