logger::utils(3tcl)
π logger::utils β Utilities for logger π
okay so bestie, welcome to logger::utils(3tcl), the Object Oriented logging facility's lil utility drawer β¨ this page is literally all about the utilities for logger, and it's gonna be so good, i promise π«Ά
β¨ 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...
no cap, that's the whole vibe right there π
πΈ DESCRIPTION πΈ
so like, this package adds template based appenders π that's the whole thing. it's giving "make your logs cute and structured."
π ::logger::utils::createFormatCmd formatString
this command translates formatString into an expandable command string. obsessed. π¦
the following strings are the known substitutions (they came from log4perl, iykyk) that are allowed to occur 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
that's the whole substitution alphabet bestie, memorize it, it's giving cheat sheet energy π
π§ ::logger::utils::createLogProc -procName procName ?options...?
This command ...
yes the original literally just trails off like that. iconic honestly. anyway, here are the options:
-procNameprocName β The name of the procedure to create.-conversionPatternpattern β See::logger::utils::createFormatCmdfor the substitutions allowed in the pattern.-categorycategory β The category (service).-prioritypriority β The priority (level).-outputChannelchannel β channel to output on (defaultstdout)
default stdout?? yes ma'am, that's the default π
π ::logger::utils::applyAppender -appender appenderType ?options...?
This command will create an appender for the specified logger services. If no service is specified then the appender will be added as the default appender for the specified levels. If no levels are specified, then all levels are assumed. periodt. β¨
-serviceloggerservices-serviceCmdloggerserviceCmds β Name of the logger instance to modify.-serviceCmdtakes as input the return oflogger::init.-appenderappenderType β Type of the appender to use. One ofconsole,colorConsole.-appenderArgsappenderArgs β Additional arguments to apply to the appender. The argument of the option is a list of options and their arguments.
For example
logger::utils::applyAppender -serviceCmd $log -appender console -appenderArgs {-conversionPattern {\[%M\] \[%p\] - %m}}
The usual Tcl quoting rules apply.
-levelslevelList β The list of levels to apply this appender to. If 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
look at that output. so clean. so slay. π
π¦ ::logger::utils::autoApplyAppender command command-string log op args...
This command is designed to be added via trace leave to calls of logger::init. It will look at preconfigured state (via ::logger::utils::applyAppender) to autocreate appenders for newly created logger instances. It will return its argument log. no cap, it hands log right back to you π«Ά
π« Example of usage:
logger::utils::applyAppender -appender console
set log [logger::init applyAppender-3]
${log}::error "this is an error"
π BUGS, IDEAS, FEEDBACK π
This document, and the package it describes, will undoubtedly contain bugs and other problems. π bestie we know. Please report such in the category logger of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation. we love ideas here π
When proposing code changes, please provide unified diffs, i.e the output of diff -u.
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. fr fr, do it that way π
π KEYWORDS π
appender, logger
π CATEGORY π
Programming tools
π COPYRIGHT π
Copyright (c) 2005 Aamer Akhter <aakhter@cisco.com>
and that's the whole page bestie!! this lil doc shipped with tcllib version 1.3.2, and it's the logger::utils(3tcl) page β go forth and append your logs with main character energy π
β¨πΈπ¦π
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- 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