logger::utils(n)
β¨ logger::utils β the logger::utils(n) page, bestie edition β¨
okay so. this is the manual page for logger::utils, a lil bundle of utilities from the Tcllib Object Oriented logging facility π it's giving "template based appenders" and honestly? obsessed.
πΈ NAME πΈ
logger::utils β utilities for logger π
π¦ SYNOPSIS π¦
package require Tcl 8.5 9
package require logger::utils ?1.3.2?
::logger::utils::createFormatCmd formatString
::logger::utils::createLogProc -procName procName ?options...?
::logger::utils::applyAppender -appender appenderType ?options...?
::logger::utils::autoApplyAppender command command-string log op args...
π DESCRIPTION π
so basically this package adds template based appenders to your logging life. main character energy fr fr β¨
::logger::utils::createFormatCmd formatString
this command takes your formatString and translates it into an expandable command string πͺ
and here's the tea β these are the known substitutions (they come from log4perl) that you're allowed to put in the formatString:
%cβ category of the logging event%Cβ fully qualified name of logging event%dβ current date inyyyy/MM/dd hh:mm:ss%Hβ hostname%mβ message to be logged%Mβ method where logging event was issued%pβ priority of logging event%Pβ pid of current process
::logger::utils::createLogProc -procName procName ?options...?
this command ... π«Ά (yes the original literally trails off like that, we love a mysterious queen)
-procNameprocName β the name of the procedure to create-conversionPatternpattern β peek at::logger::utils::createFormatCmdto see which substitutions are allowed in the pattern-categorycategory β the category (service)-prioritypriority β the priority (level)-outputChannelchannel β channel to output on (default isstdout)
::logger::utils::applyAppender -appender appenderType ?options...?
this one creates an appender for the logger services you name π« here's the vibe check:
- if you specify no service, the appender gets added as the default appender for the levels you name
- if you specify no levels, then all levels are assumed
the options:
-serviceloggerservices-serviceCmdloggerserviceCmds β the name of the logger instance to modify.-serviceCmdtakes as input the return value oflogger::init-appenderappenderType β the type of appender to use. one ofconsole,colorConsoleπ-appenderArgsappenderArgs β extra arguments to apply to the appender. the argument of the option is a list of options and their arguments.
like, for example:
logger::utils::applyAppender -serviceCmd $log -appender console -appenderArgs {-conversionPattern {\[%M\] \[%p\] - %m}}
the usual Tcl quoting rules apply, bestie π
-levelslevelList β the list of levels to apply this appender to. if it's not specified, all levels are assumed.
example of usage π
% set log [logger::init testLog]
::logger::tree::testLog
% logger::utils::applyAppender -appender console -serviceCmd $log
% ${log}::error "this is an error"
[2005/08/22 10:14:13] [testLog] [global] [error] this is an error
::logger::utils::autoApplyAppender command command-string log op args...
this one is designed to be added via trace leave to calls of logger::init π§ it'll look at the preconfigured state (set up via ::logger::utils::applyAppender) so it can autocreate appenders for newly created logger instances. and it returns its argument log. periodt π
example of usage β¨
logger::utils::applyAppender -appender console
set log [logger::init applyAppender-3]
${log}::error "this is an error"
π BUGS, IDEAS, FEEDBACK π
ngl, this document β and the package it describes β will undoubtedly contain bugs and other problems π please report them in the category logger of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist](http://core.tcl.tk/tcllib/reportlist). also please report any ideas for enhancements you may have for either the package and/or the documentation π«Ά
when proposing code changes, please provide unified diffs, i.e. the output of diff -u π
and note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. iykyk π
π KEYWORDS π
appender, logger
π CATEGORY π
Programming tools
π COPYRIGHT π
Copyright (c) 2005 Aamer Akhter <aakhter@cisco.com>
and that's the whole page, bestie π¦ this was tcllib version 1.3.2 of logger::utils(n) β slay, go forth and log β¨π
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2005 Aamer Akhter <aakhter@cisco\&.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms