1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
[comment {-*- tcl -*- doctools manpage}]
[comment {$Id: loggerUtils.man,v 1.7 2009/01/29 06:16:19 andreas_kupries Exp $}]
[manpage_begin logger::utils n 1.3]
[copyright {2005 Aamer Akhter <aakhter@cisco.com>}]
[moddesc {Object Oriented logging facility}]
[titledesc {Utilities for logger}]
[category {Programming tools}]
[require Tcl 8.4]
[require logger::utils [opt 1.3]]
[description]
[keywords logger appender]
This package adds template based [term appenders].
[list_begin definitions]
[call [cmd ::logger::utils::createFormatCmd] [arg formatString]]
This command translates [arg formatString] into an expandable command
string.
The following strings are the known substitutions (from log4perl)
allowed to occur in the [arg formatString]:
[list_begin definitions]
[def %c] Category of the logging event
[def %C] Fully qualified name of logging event
[def %d] Current date in yyyy/MM/dd hh:mm:ss
[def %H] Hostname
[def %m] Message to be logged
[def %M] Method where logging event was issued
[def %p] Priority of logging event
[def %P] Pid of current process
[list_end]
[call [cmd ::logger::utils::createLogProc] \
[option -procName] [arg procName] \
[opt [arg options]...]]
This command ...
[list_begin options]
[opt_def -procName procName]
The name of the procedure to create.
[opt_def -conversionPattern pattern]
See [cmd ::logger::utils::createFormatCmd] for the substitutions
allowed in the [arg pattern].
[opt_def -category category]
The category (service).
[opt_def -priority priority]
The priority (level).
[opt_def -outputChannel channel]
channel to output on (default stdout)
[list_end]
[call [cmd ::logger::utils::applyAppender] \
[option -appender] [arg appenderType] \
[opt [arg 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.
[para]
[list_begin options]
[opt_def -service loggerservices]
[opt_def -serviceCmd loggerserviceCmds]
Name of the logger instance to modify. [option -serviceCmd] takes as
input the return of [cmd logger::init].
[opt_def -appender appenderType]
Type of the appender to use.
One of [const console], [const colorConsole].
[opt_def -conversionPattern pattern]
See [cmd ::logger::utils::createFormatCmd] for the
format of the pattern. If this option is not provided
the default pattern
[example {[%d] [%c] [%M] [%p] %m}]
is used.
[opt_def -levels levelList]
The list of levels to apply this appender to. If not specified all
levels are assumed.
[list_end]
[para]
Example of usage:
[para]
[example {
% 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
}]
[call [cmd ::logger::utils::autoApplyAppender] \
[arg command] [arg command-string] [arg log] [arg op] [arg args]... \
]
This command is designed to be added via [cmd {trace leave}] to calls
of [cmd logger::init]. It will look at preconfigured state (via
[cmd ::logger::utils::applyAppender]) to autocreate appenders for
newly created logger instances.
It will return its argument [arg log].
[para]
Example of usage:
[para]
[example {
logger::utils::applyAppender -appender console
set log [logger::init applyAppender-3]
${log}::error "this is an error"
}]
[list_end]
[section {BUGS, IDEAS, FEEDBACK}]
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category [emph logger] of the
[uri {http://sourceforge.net/tracker/?group_id=12883} {Tcllib SF Trackers}].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
[manpage_end]
|