1logger::utils(n)       Object Oriented logging facility       logger::utils(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       logger::utils - Utilities for logger
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require logger::utils  ?1.3.1?
14
15       ::logger::utils::createFormatCmd formatString
16
17       ::logger::utils::createLogProc -procName procName ?options...?
18
19       ::logger::utils::applyAppender -appender appenderType ?options...?
20
21       ::logger::utils::autoApplyAppender   command   command-string   log  op
22       args...
23
24______________________________________________________________________________
25

DESCRIPTION

27       This package adds template based appenders.
28
29       ::logger::utils::createFormatCmd formatString
30              This command translates formatString into an expandable  command
31              string.  The following strings are the known substitutions (from
32              log4perl) allowed to occur in the formatString:
33
34              %c     Category of the logging event
35
36              %C     Fully qualified name of logging event
37
38              %d     Current date in yyyy/MM/dd hh:mm:ss
39
40              %H     Hostname
41
42              %m     Message to be logged
43
44              %M     Method where logging event was issued
45
46              %p     Priority of logging event
47
48              %P     Pid of current process
49
50       ::logger::utils::createLogProc -procName procName ?options...?
51              This command ...
52
53              -procName procName
54                     The name of the procedure to create.
55
56              -conversionPattern pattern
57                     See ::logger::utils::createFormatCmd  for  the  substitu‐
58                     tions allowed in the pattern.
59
60              -category category
61                     The category (service).
62
63              -priority priority
64                     The priority (level).
65
66              -outputChannel channel
67                     channel to output on (default stdout)
68
69       ::logger::utils::applyAppender -appender appenderType ?options...?
70              This  command  will  create an appender for the specified logger
71              services. If no service is specified then the appender  will  be
72              added  as  the  default appender for the specified levels. If no
73              levels are specified, then all levels are assumed.
74
75
76              -service loggerservices
77
78              -serviceCmd loggerserviceCmds
79                     Name of the logger instance to modify. -serviceCmd  takes
80                     as input the return of logger::init.
81
82              -appender appenderType
83                     Type  of  the appender to use.  One of console, colorCon‐
84                     sole.
85
86              -appenderArgs appenderArgs
87                     Additional arguments to apply to the appender.  The argu‐
88                     ment  of  the option is a list of options and their argu‐
89                     ments.
90
91                     For example
92
93
94                     logger::utils::applyAppender -serviceCmd $log -appender console -appenderArgs {-conversionPattern {\[%M\] \[%p\] - %m}}
95
96
97                     The usual Tcl quoting rules apply.
98
99              -levels levelList
100                     The list of levels to apply  this  appender  to.  If  not
101                     specified all levels are assumed.
102
103       Example of usage:
104
105
106
107                 % set log [logger::init testLog]
108                 ::logger::tree::testLog
109                 % logger::utils::applyAppender -appender console -serviceCmd $log
110                 % ${log}::error "this is an error"
111                 [2005/08/22 10:14:13] [testLog] [global] [error] this is an error
112
113
114       ::logger::utils::autoApplyAppender   command   command-string   log  op
115       args...
116              This command is designed to be added via trace leave to calls of
117              logger::init.  It  will  look at preconfigured state (via ::log‐
118              ger::utils::applyAppender) to  autocreate  appenders  for  newly
119              created logger instances.  It will return its argument log.
120
121              Example of usage:
122
123
124
125                logger::utils::applyAppender -appender console
126                set log [logger::init applyAppender-3]
127                ${log}::error "this is an error"
128
129

BUGS, IDEAS, FEEDBACK

131       This  document,  and the package it describes, will undoubtedly contain
132       bugs and other problems.  Please report such in the category logger  of
133       the  Tcllib  Trackers  [http://core.tcl.tk/tcllib/reportlist].   Please
134       also report any ideas for enhancements you may have for either  package
135       and/or documentation.
136
137       When proposing code changes, please provide unified diffs, i.e the out‐
138       put of diff -u.
139
140       Note further that  attachments  are  strongly  preferred  over  inlined
141       patches.  Attachments  can  be  made  by  going to the Edit form of the
142       ticket immediately after its creation, and  then  using  the  left-most
143       button in the secondary navigation bar.
144

KEYWORDS

146       appender, logger
147

CATEGORY

149       Programming tools
150
152       Copyright (c) 2005 Aamer Akhter <aakhter@cisco.com>
153
154
155
156
157tcllib                               1.3.1                    logger::utils(n)
Impressum