Stk.LogSourceLogging.
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 the main log source, used by debug, info, warning, error and app. Default level is Logs.warning. The set_level function should be used to modify the log level of the source; it also updates some internal structure to prevent creating a new closure each time debug is called, by using the [%debug] node extension.
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 LOGinclude Logs.LOGval msg : Logs.level -> 'a Logs.logSee Logs.msg.
val app : 'a Logs.logapp is msg App.
val err : 'a Logs.logerr is msg Error.
val warn : 'a Logs.logwarn is msg Warning.
val info : 'a Logs.loginfo is msg Info.
val debug : 'a Logs.logdebug is msg Debug.
val kmsg : (unit -> 'b) -> Logs.level -> ('a, 'b) Logs.msgf -> 'bSee Logs.kmsg.
result value Errorsval on_error :
?level:Logs.level ->
?header:string ->
?tags:Logs.Tag.set ->
pp:(Format.formatter -> 'b -> unit) ->
use:('b -> 'a) ->
('a, 'b) result ->
'aSee Logs.on_error.
val on_error_msg :
?level:Logs.level ->
?header:string ->
?tags:Logs.Tag.set ->
use:(unit -> 'a) ->
('a, [ `Msg of string ]) result ->
'aSee Logs.on_error_msg.
val set_level : Logs.level option -> unitThe list of stk log sources (i.e. the log sources created by create_src).