package stk
Install
Dune Dependency
Authors
Maintainers
Sources
md5=c334ffabde8b710f1eba6699db0f601a
sha512=7978e3f10bc196ee6177ded9ae0313a5ba65e1a74e501fbecbe5ebc216ca6ee7117deaff5bc4c414083a4a55851a81e5dedaa8d0a880ad72689b3f56f3b064f5
doc/stk/Stk/Log/index.html
Module Stk.Log
Source
Logging.
Stk uses a Logs.Src.t
whose log functions are available in this module. Some modules also uses their own Logs.Src.t
(like Textview
or Textbuffer
).
At load time, the environment variable STK_lOG_LEVEL
is read to initialize the log level of log_src
. Default is Logs.warning
.
The create_src
function creates a new log source whose messages are tagged with the "stk"
tag. This is useful to separate Stk log messages from other log messages, as stk log messages should not be displayed in the Gui (this could cause some infinite loop). The creation of a new log source reads the corresponding environment variable to initialize the log level of the new source. For example, !create_src "stk.foo"
will create a new log source and whose level will be initialized by looking at the STK_FOO_LOG_LEVEL
.
Textlog
module provides a Logs.reporter
to dispatch messages based on the tags attached to the message.
Tag for Stk log messages.
include LOG
val log_src : Logs.Src.t
include Logs.LOG
Log functions
val msg : Logs.level -> 'a Logs.log
See Logs.msg
.
val app : 'a Logs.log
app
is msg App
.
val err : 'a Logs.log
err
is msg Error
.
val warn : 'a Logs.log
warn
is msg Warning
.
val info : 'a Logs.log
info
is msg Info
.
val debug : 'a Logs.log
debug
is msg Debug
.
val kmsg : (unit -> 'b) -> Logs.level -> ('a, 'b) Logs.msgf -> 'b
See Logs.kmsg
.
Logging result
value Error
s
val on_error :
?level:Logs.level ->
?header:string ->
?tags:Logs.Tag.set ->
pp:(Format.formatter -> 'b -> unit) ->
use:('b -> 'a) ->
('a, 'b) result ->
'a
See Logs.on_error
.
val on_error_msg :
?level:Logs.level ->
?header:string ->
?tags:Logs.Tag.set ->
use:(unit -> 'a) ->
('a, [ `Msg of string ]) result ->
'a
See Logs.on_error_msg
.
The list of stk log sources (i.e. the log sources created by create_src
).