1logger::utils(n) Object Oriented logging facility logger::utils(n)
2
3
4
5______________________________________________________________________________
6
8 logger::utils - Utilities for logger
9
11 package require Tcl 8.4
12
13 package require logger::utils ?1.3?
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
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 -conversionPattern pattern
87 See ::logger::utils::createFormatCmd for the format of
88 the pattern. If this option is not provided the default
89 pattern
90 [%d] [%c] [%M] [%p] %m
91 is used.
92
93 -levels levelList
94 The list of levels to apply this appender to. If not
95 specified all levels are assumed.
96
97 Example of usage:
98
99
100 % set log [logger::init testLog]
101 ::logger::tree::testLog
102 % logger::utils::applyAppender -appender console -serviceCmd $log
103 % ${log}::error "this is an error"
104 [2005/08/22 10:14:13] [testLog] [global] [error] this is an error
105
106
107 ::logger::utils::autoApplyAppender command command-string log op
108 args...
109 This command is designed to be added via trace leave to calls of
110 logger::init. It will look at preconfigured state (via ::log‐
111 ger::utils::applyAppender) to autocreate appenders for newly
112 created logger instances. It will return its argument log.
113
114 Example of usage:
115
116
117 logger::utils::applyAppender -appender console
118 set log [logger::init applyAppender-3]
119 ${log}::error "this is an error"
120
121
123 This document, and the package it describes, will undoubtedly contain
124 bugs and other problems. Please report such in the category logger of
125 the Tcllib SF Trackers [http://source‐
126 forge.net/tracker/?group_id=12883]. Please also report any ideas for
127 enhancements you may have for either package and/or documentation.
128
130 appender, logger
131
133 Copyright (c) 2005 Aamer Akhter <aakhter@cisco.com>
134
135
136
137
138log 1.3 logger::utils(n)