ILogWriter

The LOG writer is the class that finally outputs a LOG message to console, to a file or over the network.

A LOG writer has its own level. When a logger makes a LOG output, its level is compared with that of the writer. If the level of the logger is equal to or more important than that of the writer, an output occurs. Otherwise, the output will be prevented.

The level of the writer

The level of the writer is set via this method.

void setLevel(@NotNull ELevel aLevel);

The levels of the loggers

The levels of the loggers are saved in the respective writer. The same logger can have a different level in a different Writer.

The name of the logger is stored in package notation, like a JAVA package. If a level is set to the first part of a package, all packages below it will contain that level. An exception is when a sub-package has its own level, in which case that level is used.

Example:

If "a.b.c" the level is DEBUG,
then the level for "a.b.c.d" is also DEBUG.
However, if the level for "a.b.c.d.CMyClass" is WARN, it will remain WARN.

void setLevel(@NotNull String aName,
              @NotNull ELevel aLevel);

A level of a logger can also be removed again.

void removeLevel(@NotNull String aName);

Calculation of the resulting level

The level that applies to a given path can be calculated using this method:

ELevel calcLevel(String aName);

Message formatter

For formatting the LOG text, a message formatter can be installed.

void setMessageFormatter(@Nullable IMessageFormatter aFormatter);

Starting and Stopping

The writer is started and stopped by the system.

void start() throws Exception;
void stop() throws Exception;

nyssr.net - Innovative Distributed System