Click or drag to resize

LoggerBase class

Abstract basis for various loggers; implements IInfoViewer.
Inheritance hierarchy
SystemObject
  NetEti.ApplicationControlLoggerBase
    NetEti.ApplicationControlLogger

Namespace: NetEti.ApplicationControl
Assembly: NetEti.Logging (in NetEti.Logging.dll) Version: 1.0.0+b865061c8026804ece26684b7dc3403284234a08
Syntax
public abstract class LoggerBase : InfoViewer,
	 
	IFlushable, IDisposable

The LoggerBase Type exposes the following members.

Constructors
 NameDescription of the
Public MethodLoggerBase Constructor: sets the path name for the log file.
Back to the top
Properties
 NameDescription of the
Public PropertyDebugArchiveMaxCount 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).
Public PropertyDebugArchivingInterval Time interval in which the current logging (DebugFile, etc.) is archived and emptied. Must be set externally. Default: TimeSpan.Zero.
Public PropertyIsTimerTriggered 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.
Public PropertyLoggingTriggerCounter Number of milliseconds or number of counting operations until the next logging output; Default: 5000.
Public PropertyLogTargetInfo Target path, e.g. for text logs, name and path of the log file.
Public PropertyMaxBufferLineCount Maximum number of lines that a MessageBuffer can hold, before it is forcibly flushed. This setting works even with timer-controlled logging. Default: 10000.
Protected PropertyPlainMessage 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
 NameDescription of the
Public MethodStatic MemberCutLog(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.
Public MethodStatic MemberCutLog(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.
Public MethodDispose Public method for cleaning up.
Protected MethodDispose(Boolean) This can be tidied up if necessary.
Protected MethodFinalise Finaliser: is called by the GarbageCollector.
(Overwrites ObjectFinalise)
Public MethodFlush Ensures that all pending actions are executed. e.g. filled intermediate tables (buffers) are processed (flushed).
Public MethodHandleInfo Callback for logging the message: is created by the responsible InfoController provided that you have registered in advance.
Public MethodLog 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.
Protected MethodOrganiseLoggings Provides the option to clean up loggings. Does nothing itself, can be overwritten.
Public MethodShow Can be overwritten to display the log; for text files, e.g. via output to the standard editor.
Public MethodStop Must be called at the end of processing to stop the timer.
Protected MethodWriteLog 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