logger::utils(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ 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 in yyyy/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)

  • -procName procName β€” the name of the procedure to create
  • -conversionPattern pattern β€” peek at ::logger::utils::createFormatCmd to see which substitutions are allowed in the pattern
  • -category category β€” the category (service)
  • -priority priority β€” the priority (level)
  • -outputChannel channel β€” channel to output on (default is stdout)

::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:

  • -service loggerservices
  • -serviceCmd loggerserviceCmds β€” the name of the logger instance to modify. -serviceCmd takes as input the return value of logger::init
  • -appender appenderType β€” the type of appender to use. one of console, colorConsole 🌈
  • -appenderArgs appenderArgs β€” 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 πŸ“

  • -levels levelList β€” 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 (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