Table of Contents

ILoggerFluentApi

Namespace
ZCore
INTERFACE ILoggerFluentApi

This interface gives access to log messages with a fluent API for writing log messages, for details see ILogger The fluent API offers several ways to trigger log messages only under certain conditions, e.g.

logger.AtDebug().LogMessage('hello world');
logger.AtDebug().WithRisingTrigger(boolean1).LogMessage('boolean1 just got true');
logger.AtDebug().WithFallingTrigger(boolean1).LogMessage('boolean1 just got false');
logger.AtDebug().WithCondition(counter > 5).Append('counter exceeds ').AppendInt(5);

Methods

AtDebug

METHOD AtDebug () : ILoggerFluentAtLevel

Initiates logging a message fluently with log-severity level Debug if the severity level applies.

logger.AtDebug().LogMessage('hello world');

A Debug message is less granular compared to the trace level, but it is more than you will need in everyday use. The debug log level should be used for information that may be needed for diagnosing issues and troubleshooting or when running an application in a test environment for the purpose of making sure everything is running correctly. For more information about this loglevel, see sematext.

Returns

ILoggerFluentAtLevel

AtError

METHOD AtError () : ILoggerFluentAtLevel

Initiates logging a message fluently with log-severity level Error if the severity level applies.

logger.AtError().LogMessage('hello world');

The error level should be used when the application hits an issue preventing one or more functionalities from properly functioning. For instance, if a servo-motor can not reach its desired position or if a sudden pneumatic pressure drop occurs. For more information about this loglevel, see sematext.

Returns

ILoggerFluentAtLevel

AtFatal

METHOD AtFatal () : ILoggerFluentAtLevel

Initiates logging a message fluently with log-severity level Fatal if the severity level applies.

logger.AtFatal().LogMessage('hello world');

The error level should be used when the application hits errors that stop the booting process or other hardward related issues (device that is disconnected while using, fieldbus interruptions, ...). For more information about this loglevel, see sematext.

Returns

ILoggerFluentAtLevel

AtInfo

METHOD AtInfo () : ILoggerFluentAtLevel

Initiates logging a message fluently with log-severity level Info if the severity level applies.

logger.AtInfo().LogMessage('hello world');

Info is the standard log level and is indicating that something happened, i.e. the application entered a certain state For instance, an operator of your production system starts the automatic sequence and this can be logged as info if it was successfull or not. The information logged using the info log level should be purely informative and not looking into them on a regular basis shouldn’t result in missing any important information. For more information about this loglevel, see sematext.

Returns

ILoggerFluentAtLevel

AtTrace

METHOD AtTrace () : ILoggerFluentAtLevel

Initiates logging a message fluently with log-severity level Trace if the severity level applies.

logger.AtTrace().LogMessage('hello world');

Trace is the most fine-grained information only used in rare cases where you need the full visibility of what is happening in your application and inside the third-party libraries that you use. You can expect the trace logging level to be very verbose. You can use it for example to annotate each step in a sequence or extra entries in different if branches. For more information about this loglevel, see sematext.

Returns

ILoggerFluentAtLevel

AtWarning

METHOD AtWarning () : ILoggerFluentAtLevel

Initiates logging a message fluently with log-severity level Warning if the severity level applies.

logger.AtWarning().LogMessage('hello world');

A warning indicates that something unexpected happened in the application, a problem, or a situation that might disturb one of the processes. But that doesn’t mean that the application failed or the production system had to be stopped. The warning log level should be used in situations that are unexpected, but the code can continue the work. For example, an electric motor (servo) has two levels for overheating. A warning temperature and a temperature were it is very likely that it will soon get broken. For more information about this loglevel, see sematext.

Returns

ILoggerFluentAtLevel