Codeboxes 0.0.1
Loading...
Searching...
No Matches
Codeboxes.Monitor.Logger Class Reference

This class can be used as a simple Logger. It provides the ImpactLevels as functions and takes the related source as a constructor argument. Best practice is, to use it as followed: More...

Inheritance diagram for Codeboxes.Monitor.Logger:
Codeboxes.Monitor.Interfaces.ILogger

Public Member Functions

 Logger (object source, [AllowNull] string monitorParty=null)
 Constructs a new Logger instance, which can be used for shorter log calls by giving a function for each ImpactLevel.
 
void Dispose ()
 Destroys this instance, so it can't be used afterwards any longer.
 
void Info (string message, [AllowNull] string details=null, [AllowNull] ImpactTopic topic=null)
 Calls the Log function at the Monitor with ImpactLevel.INFO, the source from the constructor and the arguments, given by this function. This will not work, if this instance was disposed.
 
void Debug (string message, [AllowNull] string details=null, [AllowNull] ImpactTopic topic=null)
 Calls the Log function at the Monitor with ImpactLevel.DEBUG, the source from the constructor and the arguments, given by this function. This will not work, if this instance was disposed.
 
void Warn (string message, [AllowNull] string details=null, [AllowNull] ImpactTopic topic=null)
 Calls the Log function at the Monitor with ImpactLevel.WARN, the source from the constructor and the arguments, given by this function. This will not work, if this instance was disposed.
 
void Error (string message, [AllowNull] string details=null, [AllowNull] ImpactTopic topic=null)
 Calls the Log function at the Monitor with ImpactLevel.ERROR, the source from the constructor and the arguments, given by this function. This will not work, if this instance was disposed.
 
void Fatal (string message, [AllowNull] string details=null, [AllowNull] ImpactTopic topic=null)
 Calls the Log function at the Monitor with ImpactLevel.FATAL, the source from the constructor and the arguments, given by this function. This will not work, if this instance was disposed.
 
void Log (ImpactLevel level, string message, [AllowNull] object source=null, [AllowNull] string details=null, [AllowNull] ImpactTopic topic=null)
 Adds a log entry to the given monitor, given by the monitorParty at the constructor. The Source of this will ignored by this call.
 
- Public Member Functions inherited from Codeboxes.Monitor.Interfaces.ILogger

Properties

String Source [get]
 this is the source, which is passed to each log call of this instance, which is given by the constructor
 
Monitor Monitor [get]
 this is the monitor, which is used at every log call; the monitorParty, which is given by the constructor, decides which instance of the Monitor is used;
 

Detailed Description

This class can be used as a simple Logger. It provides the ImpactLevels as functions and takes the related source as a constructor argument.

Best practice is, to use it as followed:

class MyClass
{
private static Logger LOG = new Logger(MyClass);
//or
private static Logger LOG = new Logger(MyClass, "myMonitorParty");
...
void MyFunc (args)
{
...
LOG.warn("my message", "the details (stacktrace)", ImpactTopic.SOME);
//or just:
LOG.info("my message");
}
}
This class is used at log and alert factories by the Monitor to determine the impact topic of the add...
Definition ImpactTopic.cs:17
This class can be used as a simple Logger. It provides the ImpactLevels as functions and takes the re...
Definition Logger.cs:35

In case you have created or using a custom ImpactLevel, you should extend this class and add the related function by your own, due to that we "just" give the call to the Monitor instance.

Constructor & Destructor Documentation

◆ Logger()

Codeboxes.Monitor.Logger.Logger ( object source,
[AllowNull] string monitorParty = null )
inline

Constructs a new Logger instance, which can be used for shorter log calls by giving a function for each ImpactLevel.

Parameters
sourcethe source, which will be passed to each log call of this instance
monitorPartythe monitor instance key, which will be used for each log call of this instance

Member Function Documentation

◆ Debug()

void Codeboxes.Monitor.Logger.Debug ( string message,
[AllowNull] string details = null,
[AllowNull] ImpactTopic topic = null )
inline

Calls the Log function at the Monitor with ImpactLevel.DEBUG, the source from the constructor and the arguments, given by this function. This will not work, if this instance was disposed.

Parameters
messagethe log message (or a short info)
detailsthe stacktrace of an error or the long info
topicthe topic of the log

◆ Dispose()

void Codeboxes.Monitor.Logger.Dispose ( )
inline

Destroys this instance, so it can't be used afterwards any longer.

◆ Error()

void Codeboxes.Monitor.Logger.Error ( string message,
[AllowNull] string details = null,
[AllowNull] ImpactTopic topic = null )
inline

Calls the Log function at the Monitor with ImpactLevel.ERROR, the source from the constructor and the arguments, given by this function. This will not work, if this instance was disposed.

Parameters
messagethe log message (or a short info)
detailsthe stacktrace of an error or the long info
topicthe topic of the log

◆ Fatal()

void Codeboxes.Monitor.Logger.Fatal ( string message,
[AllowNull] string details = null,
[AllowNull] ImpactTopic topic = null )
inline

Calls the Log function at the Monitor with ImpactLevel.FATAL, the source from the constructor and the arguments, given by this function. This will not work, if this instance was disposed.

Parameters
messagethe log message (or a short info)
detailsthe stacktrace of an error or the long info
topicthe topic of the log

◆ Info()

void Codeboxes.Monitor.Logger.Info ( string message,
[AllowNull] string details = null,
[AllowNull] ImpactTopic topic = null )
inline

Calls the Log function at the Monitor with ImpactLevel.INFO, the source from the constructor and the arguments, given by this function. This will not work, if this instance was disposed.

Parameters
messagethe log message (or a short info)
detailsthe stacktrace of an error or the long info
topicthe topic of the log

◆ Log()

void Codeboxes.Monitor.Logger.Log ( ImpactLevel level,
string message,
[AllowNull] object source = null,
[AllowNull] string details = null,
[AllowNull] ImpactTopic topic = null )
inline

Adds a log entry to the given monitor, given by the monitorParty at the constructor. The Source of this will ignored by this call.

Parameters
levelthe level of the log entry
messagethe message of the log entry aka the short info
sourcethe source of the log entry
detailsthe stacktrace of an error or the long info
topicthe topic of the log entry

Implements Codeboxes.Monitor.Interfaces.ILogger.

◆ Warn()

void Codeboxes.Monitor.Logger.Warn ( string message,
[AllowNull] string details = null,
[AllowNull] ImpactTopic topic = null )
inline

Calls the Log function at the Monitor with ImpactLevel.WARN, the source from the constructor and the arguments, given by this function. This will not work, if this instance was disposed.

Parameters
messagethe log message (or a short info)
detailsthe stacktrace of an error or the long info
topicthe topic of the log

Property Documentation

◆ Monitor

Monitor Codeboxes.Monitor.Logger.Monitor
get

this is the monitor, which is used at every log call; the monitorParty, which is given by the constructor, decides which instance of the Monitor is used;

◆ Source

String Codeboxes.Monitor.Logger.Source
get

this is the source, which is passed to each log call of this instance, which is given by the constructor


The documentation for this class was generated from the following file: