Represents the configuration of the logger. An instance can be passed to Env.initLogger to setup the logger behaviour.

Constructor

new()

Methods

beautify(enable:Bool):LoggerConfig

Set whether the logs must be written in beautified format. This method is deprecated and it has no effect.

Parameters:

enable

Whether beautified logging should be enabled (defaults to false).

Returns:

LoggerConfig this instance to support a fluent interface.

handlers(handlers:Collection<LoggerHandler>):LoggerConfig

Sets the handlers for the logger. Default is a handler with a plain formatter and a file writer.

Parameters:

handlers

Collection of handlers.

Returns:

LoggerConfig this instance to support a fluent interface.

level(level:Int):LoggerConfig

Sets the logging level. Default is Logger.LEVEL_INFO.

Parameters:

level

Level of log. One of: Logger.LEVEL_ERROR, Logger.LEVEL_WARNING, Logger.LEVEL_INFO, Logger.LEVEL_DEBUG.

Returns:

this instance to support a fluent interface.

levelName(level:String):LoggerConfig

Sets the logging level. Default is Logger.LEVEL_INFO.

Parameters:

level

Level of log. One of: "ERROR", "WARNING", "INFO", "DEBUG".

Returns:

this instance to support a fluent interface.

markdown(enable:Bool):LoggerConfig

Sets whether the logger should use the Markdown formatter. This method is deprecated and it has no effect. By default, the plain text formatter is used.

Parameters:

enable

Whether to use the Markdown formatter.

Returns:

LoggerConfig this instance to support a fluent interface.

maskedFields(maskedFields:Collection<String>):LoggerConfig

Sets the fields which should be masked in the logs, by default only Authorization field is masked.

NOTE: If the logger is in DEBUG level, nothing will get masked.

Parameters:

maskedFields

Collection of field names (string).

Returns:

LoggerConfig this instance to support a fluent interface.

maskedParams(maskedParams:Collection<String>):LoggerConfig

Sets the id of the params whose "value" field should be masked in the logs. This will not mask "structured_value". For that, add the field names to maskedFields.

NOTE: If the logger is in DEBUG level, nothing will get masked.

Parameters:

maskedParams

Collection of param ids (string).

Returns:

LoggerConfig this instance to support a fluent interface.

path(path:String):LoggerConfig

Sets the path where logs will be stored. Default is "logs". When using a Processor to process requests, the Flows in the processor will use Logger.setFilename to switch to the correct filename based on the id of the element being processed. When not using the Processor at all, remember to call Logger.setFilename after initializing the Log or log messages will only be printed to the standard output (usually, the terminal).

Parameters:

path

Path for logs.

Returns:

this instance to support a fluent interface.

regexMasks(expressions:Collection<String>):LoggerConfig

Sets whether the logs must be written in compact format (this is, for JSON objects only prints key names or, if it has an 'id' field, only the id). This is ignored if the logger is created in LEVEL_DEBUG. This method is deprecated and it has no effect.

Parameters:

enable

Whether compact logging should be enabled.

Returns:

LoggerConfig this instance to support a fluent interface.