package easy_logging
Install
Dune Dependency
Authors
Maintainers
Sources
md5=e4e71624902c7c06c75da8314287b0b7
sha512=415b5ef14d05173c28acbec467cf5a6906fce5dd244658fbee7673cc516d23c0aa069984330befe85270b708af070e40275eb1c2e78bdf8f717116454c237d0c
doc/easy_logging/Easy_logging/Logging/class-logger/index.html
Class Logging.logger
Source
Attributes
Name of the logger:
- can be displayed in log messages.
- defines the logger place in the logging tree.
val mutable handlers : Handlers.t list
Registered handlers for this logger.
val parent : logger option
The optional parent of this logger.
Whether messages passed to this logger are propagated to its ancestors' handlers.
The list of functions used for dynamic tagging of messages
Classic logging Methods
Each of these methods takes an optional string list
of tags, then a set of parameters the way a printf function does. If the log level of the instance is low enough, a log item will be created theb passed to the handlers.
Example :
logger#warning "Unexpected value: %s" (to_string my_value)
method flash : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a
method error : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a
method warning : 'a. ?tags:string list ->
('a, unit, string, unit) format4 ->
'a
method info : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a
method trace : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a
method debug : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a
Lazy logging methods
Each of these methods takes a string lazy_t
as an input (as well as the optional tags. If the log level of the instance is low enough, the lazy value will forced into a string
, a log item will be created then passed to the handlers.
Example:
logger#ldebug (lazy (heavy_calculation () ))
String logging methods
Each of these methods takes a string
as an input (as well as the optional tags).
Example:
logger#sdebug string_variable
Other methods
Sets the log level of the logger instance.
method add_handler : Handlers.t -> unit
Adds a handler to the logger instance.
method get_handlers : Handlers.t list
method set_handlers : Handlers.t list -> unit
Will add a tag to each log message, resulting from the call of the supplied fonction (called each time a message is logged)
Sets the propagate attribute, which decides whether messages passed to this logger are propagated to its ancestors' handlers.
Internal methods
method get_handlers_propagate : Handlers.t list
Returns the list of handlers of the logger, recursing with parents handlers if propagate is true