package devkit
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dae965685dceed47ad8e9844f12fe707dafdf2c3bdd46d0431d5b4d1e7754b23
sha512=b94ade804d751db87434042bbaa821fa8e82e233820a76806f910e2da040094b137e88a3579911a1626930912622b064c776ddbcb6991fb7111021ebf6553fdc
doc/devkit.core/Devkit_core/Log/index.html
Module Devkit_core.Log
Source
Global ready-to-use logger
TODO interface to manage State
Example usage
Create logging facility (messages origin)
let http = Log.facility "http"
Log from http subsystem at debug level
Log.debug http "received %u bytes"
Create and use object for http logging
let log = Log.from "http" (* new Log.logger http *);;
log#info "sent %u bytes" 1024
log#warn ~exn "failed here"
Output only messages of warning level or higher for the http facility
http#allow `Warn
or
Logger.set_filter http `Warn
or
Log.set_filter ~name:"http" `Warn
or
Log.set_filter ~name:"http*" `Warn
to set for all facilities starting with "http"
Output only messages of warning level or higher for all facilities
Log.set_filter `Warn
API
Update facilities configuration from the environment.
By default, it reads the configuration in the environment variable DEVKIT_LOG
which can be overwritten using the optional process_name
parameter.
The value of environment variable should match the following grammar: ([<facil|prefix*>=]debug|info|warn|error[,])*
type 'a pr =
?exn:exn ->
?lines:bool ->
?backtrace:bool ->
?saved_backtrace:string list ->
('a, unit, string, unit) format4 ->
'a
param lines
: whether to split multiline message as separate log lines (default true
)
param backtrace
: whether to show backtrace (default is true
if exn
is given and backtrace recording is enabled)
param saved_backtrace
: supply backtrace to show instead of using Printexc.get_backtrace
reopen log file