 | LoggerBase class |
Abstract basis for various loggers;
implements IInfoViewer.
Inheritance hierarchy Namespace: NetEti.ApplicationControlAssembly: NetEti.Logging (in NetEti.Logging.dll) Version: 1.0.0+b865061c8026804ece26684b7dc3403284234a08
Syntaxpublic abstract class LoggerBase : InfoViewer,
IFlushable, IDisposable
Public MustInherit Class LoggerBase
Implements InfoViewer, IFlushable, IDisposable
public ref class LoggerBase abstract : InfoViewer,
IFlushable, IDisposable
[<AbstractClassAttribute>]
type LoggerBase =
class
interface InfoViewer
interface IFlushable
interface IDisposable
end
The LoggerBase Type exposes the following members.
Constructors
Properties | Name | Description of the |
---|
 | DebugArchiveMaxCount |
Maximum number of archived logs (debug files, etc.).
If there is a surplus, the oldest ones are deleted.
Default: 0 (corresponds to an infinite number).
|
 | DebugArchivingInterval |
Time interval in which the current logging (DebugFile, etc.)
is archived and emptied. Must be set externally.
Default: TimeSpan.Zero.
|
 | IsTimerTriggered |
With True, the logging output is time-controlled.
LoggingTriggerCounter then returns the number of milliseconds
until the next trigger event.
If False, the output is divided by the total number
counting processes are controlled. LoggingTriggerCounter defined
here is the number of counting processes after which the output takes place;
Default: True.
|
 | LoggingTriggerCounter |
Number of milliseconds or number of counting operations until the
next logging output;
Default: 5000.
|
 | LogTargetInfo |
Target path, e.g. for text logs, name and path of the log file.
|
 | MaxBufferLineCount |
Maximum number of lines that a MessageBuffer can hold,
before it is forcibly flushed. This setting works
even with timer-controlled logging.
Default: 10000.
|
 | PlainMessage |
If True, messages are output unchanged; due to asynchrony
of message handling can lead to sequence swaps.
If False, messages are provided with a timestamp and are prefixed with
Flush of the message buffer sorted by timestamp.
Default: False.
|
Back to the top
Methods | Name | Description of the |
---|
  | CutLog(String, Int64, Boolean) |
Shortens the log file 'logPath' to the last 'countItems' entries.
The original log file is saved with the extension '.last'.
If 'countLines' is false, the entries with the last 'countItems' remain
date values, otherwise the last 'countItems' lines.
|
  | CutLog(String, Int64, Int64, Boolean) |
Shortens the log file 'logPath' to the last 'countItems' entries.
The original log file is saved with the extension '.last'.
If 'countLines' is false, the entries with the last 'countItems' remain
date values, otherwise the last 'countItems' lines.
|
 | Dispose |
Public method for cleaning up.
|
 | Dispose(Boolean) |
This can be tidied up if necessary.
|
 | Finalise |
Finaliser: is called by the GarbageCollector.
(Overwrites ObjectFinalise) |
 | Flush |
Ensures that all pending actions are executed.
e.g. filled intermediate tables (buffers)
are processed (flushed).
|
 | HandleInfo |
Callback for logging the message: is created by the responsible InfoController
provided that you have registered in advance.
|
 | Log |
Accepts an entry for logging.
Provides timer- or counter-controlled buffering of messages.
Does not log itself directly, but calls the method abstract defined here
WriteLog, in which the physical writing then takes place.
Flows the buffer asynchronously to improve logging performance.
|
 | OrganiseLoggings |
Provides the option to clean up loggings. Does nothing itself, can be overwritten.
|
 | Show |
Can be overwritten to display the log;
for text files, e.g. via output to the standard editor.
|
 | Stop |
Must be called at the end of processing to stop the timer.
|
 | WriteLog |
Writes an entry to the log file (or somewhere else), but is not recognised externally.
directly; rather, the logger should be called as a viewer
in the InfoController.
|
Back to the top
Remarks
File: LoggerBase.cs
Author: Erik Nagel, NetEti
08.03.2012 Erik Nagel: created
2012-03-08 Erik Nagel: CutLog(...) installed.
10.05.2013 Erik Nagel: CutLog(string logPath, long countItemsFromStart, long countItemsToEnd, bool countLines) new;
inserted when writing the truncated log System.Text.Encoding.Default.
27.08.2015 Erik Nagel: Asynchronous logging implemented.
11.08.2018 Erik Nagel: Sorting by timestamp with PlainMessage==False implemented.
See also