Tcl Library Source Code

Check-in [4955240acf]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Integrated logger fixes for ticket [e4d5ef01e7].
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4955240acf8ae6e03430f0c973babcc94a43ba31cee0fc64693ccef25df9bdb5
User & Date: aku 2019-06-24 19:31:47
References
2019-06-24
19:34 Closed ticket [e4d5ef01e7]: TclOO: class logger mixin plus 6 other changes artifact: 4172ba896e user: aku
Context
2019-06-24
21:15
Integrated profiler enhancement for ticket [0dd4b31bb8]. check-in: 1e56dce90c user: aku tags: trunk
19:31
Integrated logger fixes for ticket [e4d5ef01e7]. check-in: 4955240acf user: aku tags: trunk
18:49
Add procedures to generate random numbers that have a triangular distribution function (this is in response to ticket [cc77e167bf]). check-in: 233f6a741b user: arjenmarkus tags: trunk
18:31
log - logger::utils - Tkt [e4d5ef01e7] D regenerated Closed-Leaf check-in: c9d061ae7f user: andreask tags: logger-e4d5ef01e7
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to embedded/md/tcllib/files/modules/log/loggerUtils.md.

1
2
3
4
5
6
7
8
9
10
11
12
..
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
[//000000001]: # (logger::utils \- Object Oriented logging facility)
[//000000002]: # (Generated from file 'loggerUtils\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (Copyright &copy; 2005 Aamer Akhter <[email protected]\.com>)
[//000000004]: # (logger::utils\(n\) 1\.3 tcllib "Object Oriented logging facility")

<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
href="../../../toc.md">Table Of Contents</a> &#124; <a
href="../../../../index.md">Keyword Index</a> &#124; <a
href="../../../../toc0.md">Categories</a> &#124; <a
href="../../../../toc1.md">Modules</a> &#124; <a
href="../../../../toc2.md">Applications</a> ] <hr>
................................................................................
  - [Category](#category)

  - [Copyright](#copyright)

# <a name='synopsis'></a>SYNOPSIS

package require Tcl 8\.4  
package require logger::utils ?1\.3?  

[__::logger::utils::createFormatCmd__ *formatString*](#1)  
[__::logger::utils::createLogProc__ __\-procName__ *procName* ?*options*\.\.\.?](#2)  
[__::logger::utils::applyAppender__ __\-appender__ *appenderType* ?*options*\.\.\.?](#3)  
[__::logger::utils::autoApplyAppender__ *command* *command\-string* *log* *op* *args*\.\.\.](#4)  

# <a name='description'></a>DESCRIPTION



|







 







|







1
2
3
4
5
6
7
8
9
10
11
12
..
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
[//000000001]: # (logger::utils \- Object Oriented logging facility)
[//000000002]: # (Generated from file 'loggerUtils\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (Copyright &copy; 2005 Aamer Akhter <[email protected]\.com>)
[//000000004]: # (logger::utils\(n\) 1\.3\.1 tcllib "Object Oriented logging facility")

<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
href="../../../toc.md">Table Of Contents</a> &#124; <a
href="../../../../index.md">Keyword Index</a> &#124; <a
href="../../../../toc0.md">Categories</a> &#124; <a
href="../../../../toc1.md">Modules</a> &#124; <a
href="../../../../toc2.md">Applications</a> ] <hr>
................................................................................
  - [Category](#category)

  - [Copyright](#copyright)

# <a name='synopsis'></a>SYNOPSIS

package require Tcl 8\.4  
package require logger::utils ?1\.3\.1?  

[__::logger::utils::createFormatCmd__ *formatString*](#1)  
[__::logger::utils::createLogProc__ __\-procName__ *procName* ?*options*\.\.\.?](#2)  
[__::logger::utils::applyAppender__ __\-appender__ *appenderType* ?*options*\.\.\.?](#3)  
[__::logger::utils::autoApplyAppender__ *command* *command\-string* *log* *op* *args*\.\.\.](#4)  

# <a name='description'></a>DESCRIPTION

Changes to idoc/man/files/modules/log/loggerUtils.n.

1
2
3
4
5
6
7
8
9
10
11
12
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
'\"
'\" Generated from file 'loggerUtils\&.man' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Aamer Akhter <[email protected]\&.com>
'\"
.TH "logger::utils" n 1\&.3 tcllib "Object Oriented logging facility"
.\" The -*- nroff -*- definitions below are for supplemental macros used
.\" in Tcl/Tk manual entries.
.\"
.\" .AP type name in/out ?indent?
.\"	Start paragraph describing an argument to a library procedure.
.\"	type is type of argument (int, etc.), in/out is either "in", "out",
.\"	or "in/out" to describe whether procedure reads or modifies arg,
................................................................................
..
.BS
.SH NAME
logger::utils \- Utilities for logger
.SH SYNOPSIS
package require \fBTcl  8\&.4\fR
.sp
package require \fBlogger::utils  ?1\&.3?\fR
.sp
\fB::logger::utils::createFormatCmd\fR \fIformatString\fR
.sp
\fB::logger::utils::createLogProc\fR \fB-procName\fR \fIprocName\fR ?\fIoptions\fR\&.\&.\&.?
.sp
\fB::logger::utils::applyAppender\fR \fB-appender\fR \fIappenderType\fR ?\fIoptions\fR\&.\&.\&.?
.sp



|







 







|







1
2
3
4
5
6
7
8
9
10
11
12
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
'\"
'\" Generated from file 'loggerUtils\&.man' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2005 Aamer Akhter <[email protected]\&.com>
'\"
.TH "logger::utils" n 1\&.3\&.1 tcllib "Object Oriented logging facility"
.\" The -*- nroff -*- definitions below are for supplemental macros used
.\" in Tcl/Tk manual entries.
.\"
.\" .AP type name in/out ?indent?
.\"	Start paragraph describing an argument to a library procedure.
.\"	type is type of argument (int, etc.), in/out is either "in", "out",
.\"	or "in/out" to describe whether procedure reads or modifies arg,
................................................................................
..
.BS
.SH NAME
logger::utils \- Utilities for logger
.SH SYNOPSIS
package require \fBTcl  8\&.4\fR
.sp
package require \fBlogger::utils  ?1\&.3\&.1?\fR
.sp
\fB::logger::utils::createFormatCmd\fR \fIformatString\fR
.sp
\fB::logger::utils::createLogProc\fR \fB-procName\fR \fIprocName\fR ?\fIoptions\fR\&.\&.\&.?
.sp
\fB::logger::utils::applyAppender\fR \fB-appender\fR \fIappenderType\fR ?\fIoptions\fR\&.\&.\&.?
.sp

Changes to idoc/www/tcllib/files/modules/log/loggerUtils.html.

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
 ] <hr>
<div class="doctools">
<h1 class="doctools_title">logger::utils(n) 1.3 tcllib &quot;Object Oriented logging facility&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>logger::utils - Utilities for logger</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
................................................................................
<li class="doctools_section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">logger::utils <span class="opt">?1.3?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::logger::utils::createFormatCmd</b> <i class="arg">formatString</i></a></li>
<li><a href="#2"><b class="cmd">::logger::utils::createLogProc</b> <b class="option">-procName</b> <i class="arg">procName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">::logger::utils::applyAppender</b> <b class="option">-appender</b> <i class="arg">appenderType</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#4"><b class="cmd">::logger::utils::autoApplyAppender</b> <i class="arg">command</i> <i class="arg">command-string</i> <i class="arg">log</i> <i class="arg">op</i> <i class="arg">args</i>...</a></li>
</ul>






|







 







|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
 ] <hr>
<div class="doctools">
<h1 class="doctools_title">logger::utils(n) 1.3.1 tcllib &quot;Object Oriented logging facility&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>logger::utils - Utilities for logger</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
................................................................................
<li class="doctools_section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">logger::utils <span class="opt">?1.3.1?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::logger::utils::createFormatCmd</b> <i class="arg">formatString</i></a></li>
<li><a href="#2"><b class="cmd">::logger::utils::createLogProc</b> <b class="option">-procName</b> <i class="arg">procName</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#3"><b class="cmd">::logger::utils::applyAppender</b> <b class="option">-appender</b> <i class="arg">appenderType</i> <span class="opt">?<i class="arg">options</i>...?</span></a></li>
<li><a href="#4"><b class="cmd">::logger::utils::autoApplyAppender</b> <i class="arg">command</i> <i class="arg">command-string</i> <i class="arg">log</i> <i class="arg">op</i> <i class="arg">args</i>...</a></li>
</ul>

Changes to modules/log/log.test.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
...
438
439
440
441
442
443
444


445
446
447
# Tests for the log facility
#
# Sourcing this file into Tcl runs the tests and generates output for errors.
# No output means no errors were found.
#
# Copyright (c) 2001 by ActiveState Tool Corp.
# All rights reserved.
#
# RCS: @(#) $Id: log.test,v 1.10 2008/09/25 21:52:57 eee Exp $

# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

................................................................................

	set log [join [split [viewFile test.log] \n]]
	removeFile test.log
	list [string match *__data__* $log] [string match *__NOT__* $log]
    } {1 0}
}
::log::lvChannelForall {}



testsuiteCleanup
return






<
<







 







>
>



2
3
4
5
6
7
8


9
10
11
12
13
14
15
...
436
437
438
439
440
441
442
443
444
445
446
447
# Tests for the log facility
#
# Sourcing this file into Tcl runs the tests and generates output for errors.
# No output means no errors were found.
#
# Copyright (c) 2001 by ActiveState Tool Corp.
# All rights reserved.



# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

................................................................................

	set log [join [split [viewFile test.log] \n]]
	removeFile test.log
	list [string match *__data__* $log] [string match *__NOT__* $log]
    } {1 0}
}
::log::lvChannelForall {}

# -------------------------------------------------------------------------

testsuiteCleanup
return

Changes to modules/log/logger.man.

1
2
3

4
5
6
7
8
9
10
[comment {-*- tcl -*- doctools manpage}]
[comment {$Id: logger.man,v 1.26 2012/07/10 03:34:47 andreas_kupries Exp $}]
[vset VERSION 0.9.4]

[manpage_begin logger n [vset VERSION]]
[keywords log]
[keywords {log level}]
[keywords logger]
[keywords service]
[moddesc {Object Oriented logging facility}]
[titledesc {System to control logging of events.}]
<
<

>








1
2
3
4
5
6
7
8
9

[vset VERSION 0.9.4]
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin logger n [vset VERSION]]
[keywords log]
[keywords {log level}]
[keywords logger]
[keywords service]
[moddesc {Object Oriented logging facility}]
[titledesc {System to control logging of events.}]

Changes to modules/log/logger.test.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Tests for the logger facility.
#
# Sourcing this file into Tcl runs the tests and generates output for errors.
# No output means no errors were found.
#
# Copyright (c) 2002 by David N. Welton <[email protected]>.
# Copyright (c) 2004,2005 by Michael Schlenker <[email protected]>.
#
# $Id: logger.test,v 1.33 2011/12/21 21:28:50 mic42 Exp $

# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]







<
<







2
3
4
5
6
7
8


9
10
11
12
13
14
15
# Tests for the logger facility.
#
# Sourcing this file into Tcl runs the tests and generates output for errors.
# No output means no errors were found.
#
# Copyright (c) 2002 by David N. Welton <[email protected]>.
# Copyright (c) 2004,2005 by Michael Schlenker <[email protected]>.



# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

Changes to modules/log/loggerAppender.man.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[comment {-*- tcl -*- doctools manpage}]
[comment {$Id: loggerAppender.man,v 1.6 2009/01/29 06:16:19 andreas_kupries Exp $}]
[manpage_begin logger::appender n 1.2]
[keywords appender]
[keywords logger]
[copyright {2005 Aamer Akhter <[email protected]>}]
[moddesc {Object Oriented logging facility}]
[titledesc {Collection of predefined appenders for logger}]
[category  {Programming tools}]
[require Tcl 8.2]
[require logger::appender [opt 1.2]]
[description]

This package provides a predefined set of logger templates.

[list_begin definitions]

[call [cmd ::logger::appender::console] \
>

<
|







|







1
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[vset VERSION 1.2]
[comment {-*- tcl -*- doctools manpage}]

[manpage_begin logger::appender n [vset VERSION]]
[keywords appender]
[keywords logger]
[copyright {2005 Aamer Akhter <[email protected]>}]
[moddesc {Object Oriented logging facility}]
[titledesc {Collection of predefined appenders for logger}]
[category  {Programming tools}]
[require Tcl 8.2]
[require logger::appender [opt [vset VERSION]]]
[description]

This package provides a predefined set of logger templates.

[list_begin definitions]

[call [cmd ::logger::appender::console] \

Changes to modules/log/loggerAppender.tcl.

1
2
3
4
5
6
7
8
9
10
..
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
...
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
...
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
##Library Header
#
# $Id: loggerAppender.tcl,v 1.4 2007/02/08 22:09:54 mic42 Exp $
# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::appender
#
# Purpose:
#	collection of appenders for tcllib logger
................................................................................
	emergency red-bold
    }
}



##Procedure Header
# $Id: loggerAppender.tcl,v 1.4 2007/02/08 22:09:54 mic42 Exp $
# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::appender::console
#
# Purpose:
#	 
................................................................................
    set myProcNameVar $procName
    return $procText
}



##Procedure Header
# $Id: loggerAppender.tcl,v 1.4 2007/02/08 22:09:54 mic42 Exp $
# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::appender::colorConsole
#
# Purpose:
#	 
................................................................................
	      -category $service \
	      -priority $level ]
    set myProcNameVar $procName
    return $procText
}

##Procedure Header
# $Id: loggerAppender.tcl,v 1.4 2007/02/08 22:09:54 mic42 Exp $
# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#       ::logger::appender::fileAppend
#
# Purpose:
#
................................................................................
    return $procText
}
  	 



##Internal Procedure Header
# $Id: loggerAppender.tcl,v 1.4 2007/02/08 22:09:54 mic42 Exp $
# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#       ::logger::appender::genProcName
#
# Purpose:
#        

<







 







<







 







<







 







<







 







<







1
2

3
4
5
6
7
8
9
..
68
69
70
71
72
73
74

75
76
77
78
79
80
81
...
170
171
172
173
174
175
176

177
178
179
180
181
182
183
...
276
277
278
279
280
281
282

283
284
285
286
287
288
289
...
387
388
389
390
391
392
393

394
395
396
397
398
399
400
##Library Header
#

# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::appender
#
# Purpose:
#	collection of appenders for tcllib logger
................................................................................
	emergency red-bold
    }
}



##Procedure Header

# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::appender::console
#
# Purpose:
#	 
................................................................................
    set myProcNameVar $procName
    return $procText
}



##Procedure Header

# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::appender::colorConsole
#
# Purpose:
#	 
................................................................................
	      -category $service \
	      -priority $level ]
    set myProcNameVar $procName
    return $procText
}

##Procedure Header

# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#       ::logger::appender::fileAppend
#
# Purpose:
#
................................................................................
    return $procText
}
  	 



##Internal Procedure Header

# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#       ::logger::appender::genProcName
#
# Purpose:
#        

Changes to modules/log/loggerUtils.man.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[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]
[keywords appender]
[keywords logger]
[copyright {2005 Aamer Akhter <[email protected]>}]
[moddesc {Object Oriented logging facility}]
[titledesc {Utilities for logger}]
[category  {Programming tools}]
[require Tcl 8.4]
[require logger::utils [opt 1.3]]
[description]

This package adds template based [term appenders].

[list_begin definitions]

[call [cmd ::logger::utils::createFormatCmd] [arg formatString]]
>

<
|







|







1
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[vset VERSION 1.3.1]
[comment {-*- tcl -*- doctools manpage}]

[manpage_begin logger::utils n [vset VERSION]]
[keywords appender]
[keywords logger]
[copyright {2005 Aamer Akhter <[email protected]>}]
[moddesc {Object Oriented logging facility}]
[titledesc {Utilities for logger}]
[category  {Programming tools}]
[require Tcl 8.4]
[require logger::utils [opt [vset VERSION]]]
[description]

This package adds template based [term appenders].

[list_begin definitions]

[call [cmd ::logger::utils::createFormatCmd] [arg formatString]]

Changes to modules/log/loggerUtils.tcl.

1
2
3
4
5
6
7
8
9
10
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
...
266
267
268
269
270
271
272



273
274
275
276
277
278
279
280
281
282
283
...
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
...
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
...
530
531
532
533
534
535
536
537
538
539
540
541
##Library Header
#
# $Id: loggerUtils.tcl,v 1.6 2007/03/20 16:22:16 andreas_kupries Exp $
# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::utils::
#
# Purpose:
#	an extension to the tcllib logger module
................................................................................
    logger::import -force -namespace log logger::utils

    # @mdgen OWNER: msgs/*.msg
    ::msgcat::mcload [file join $packageDir msgs]
}

##Internal Procedure Header
# $Id: loggerUtils.tcl,v 1.6 2007/03/20 16:22:16 andreas_kupries Exp $
# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::utils::createFormatCmd
#
# Purpose:
#
................................................................................

    return $text
}



##Procedure Header
# $Id: loggerUtils.tcl,v 1.6 2007/03/20 16:22:16 andreas_kupries Exp $
# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::utils::createLogProc
#
# Purpose:
#
................................................................................
	}


	if {[regexp {%M} $text]} {
	    set methodText {
		if {[info level] < 2} {
		    set method "global"



		} else {
		    set method [lindex [info level -1] 0]
		}

	    }

	    regsub -all -- \
		{%M} \
		$text \
		{$method} \
		text
................................................................................

    set procText [subst $procText]
    return $procText
}


##Procedure Header
# $Id: loggerUtils.tcl,v 1.6 2007/03/20 16:22:16 andreas_kupries Exp $
# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::utils::applyAppender
#
# Purpose:
#
................................................................................
	    ${srvCmd}::logproc $lvl $procName
	}
    }
}


##Internal Procedure Header
# $Id: loggerUtils.tcl,v 1.6 2007/03/20 16:22:16 andreas_kupries Exp $
# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::utils::autoApplyAppender
#
# Purpose:
#
................................................................................
    }
    logger::utils::applyAppender -appender $appender -serviceCmd $log \
	-levels $levels -appenderArgs $appenderArgs
    return $log
}


package provide logger::utils 1.3

# ;;; Local Variables: ***
# ;;; mode: tcl ***
# ;;; End: ***

<







 







<







 







<







 







>
>
>



<







 







<







 







<







 







|




1
2

3
4
5
6
7
8
9
..
54
55
56
57
58
59
60

61
62
63
64
65
66
67
...
158
159
160
161
162
163
164

165
166
167
168
169
170
171
...
263
264
265
266
267
268
269
270
271
272
273
274
275

276
277
278
279
280
281
282
...
314
315
316
317
318
319
320

321
322
323
324
325
326
327
...
448
449
450
451
452
453
454

455
456
457
458
459
460
461
...
527
528
529
530
531
532
533
534
535
536
537
538
##Library Header
#

# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::utils::
#
# Purpose:
#	an extension to the tcllib logger module
................................................................................
    logger::import -force -namespace log logger::utils

    # @mdgen OWNER: msgs/*.msg
    ::msgcat::mcload [file join $packageDir msgs]
}

##Internal Procedure Header

# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::utils::createFormatCmd
#
# Purpose:
#
................................................................................

    return $text
}



##Procedure Header

# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::utils::createLogProc
#
# Purpose:
#
................................................................................
	}


	if {[regexp {%M} $text]} {
	    set methodText {
		if {[info level] < 2} {
		    set method "global"
		} elseif {[uplevel 1 {namespace which self}] == "::oo::Helpers::self"} {
		    set    method    [uplevel 1 {self class}]
		    append method :: [uplevel 1 {self method}]
		} else {
		    set method [lindex [info level -1] 0]
		}

	    }

	    regsub -all -- \
		{%M} \
		$text \
		{$method} \
		text
................................................................................

    set procText [subst $procText]
    return $procText
}


##Procedure Header

# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::utils::applyAppender
#
# Purpose:
#
................................................................................
	    ${srvCmd}::logproc $lvl $procName
	}
    }
}


##Internal Procedure Header

# Copyright (c) 2005 Cisco Systems, Inc.
#
# Name:
#	::logger::utils::autoApplyAppender
#
# Purpose:
#
................................................................................
    }
    logger::utils::applyAppender -appender $appender -serviceCmd $log \
	-levels $levels -appenderArgs $appenderArgs
    return $log
}


package provide logger::utils 1.3.1

# ;;; Local Variables: ***
# ;;; mode: tcl ***
# ;;; End: ***

Changes to modules/log/loggerUtils.test.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
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
158
159
160

161
162
163
164

165
166
167
168
169
170
171

172
173


174
175
176
177
178
179
180

181
182
183

184
185
186
187
188
189
190
191



192
193
194

195
196
197

198
199
200
201
202
203
204
205



206
207

208
209

210
211
212
213
214
215

216

217
218
219
220
221

222
223
224
# -*- tcl -*-
# Tests for the utilities to the logger facility.
#
# Sourcing this file into Tcl runs the tests and generates output for errors.
# No output means no errors were found.
#
# Copyright (c) 2005 by Aamer Aahkter
#
# $Id: loggerUtils.test,v 1.7 2006/10/09 21:41:41 andreas_kupries Exp $

# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

................................................................................
testing {
    useLocal loggerUtils.tcl logger::utils
}

# -------------------------------------------------------------------------

logger::setlevel debug

# -------------------------------------------------------------------------


namespace eval ::loggerExtension::test {

    ::tcltest::test load {} -setup {
    } -constraints {
    } -cleanup {
    } -body {
    } -returnCodes {
        ok
    } -result {}



    ::tcltest::test createFormatCmd-1 {
    check for %d
    } -setup {
    } -constraints {
    } -cleanup {

    } -body {
    set a [logger::utils::createFormatCmd %d]
    set b [subst $a]
    regexp {\d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d} $b
    } -result {1}

    ::tcltest::test createFormatCmd-2 {
    check for %P
    } -setup {
    } -constraints {
    } -cleanup {

    } -body {
    set a [logger::utils::createFormatCmd %P]
    set b [subst $a]
    } -returnCodes {
        ok
    } -result [pid]

    ::tcltest::test createFormatCmd-3 {
    check for %H
    } -setup {
    } -constraints {
    } -cleanup {

    } -body {
    set a [logger::utils::createFormatCmd %H]
    set b [subst $a]
    } -returnCodes {
        ok
    } -result [info hostname]

    ::tcltest::test createFormatCmd-4 {
    check for %c
    } -setup {
    } -constraints {
    } -cleanup {

    } -body {
    set a [logger::utils::createFormatCmd %c -category test::cat ] 
    set b [subst $a]
    } -returnCodes {
        ok
    } -result test::cat

    ::tcltest::test createFormatCmd-5 {
    check for %C
    } -setup {
    } -constraints {
    } -cleanup {

    } -body {
    set a [logger::utils::createFormatCmd %C -category test::cat ] 
    set b [subst $a]
    } -returnCodes {
        ok
    } -result test

    ::tcltest::test createFormatCmd-6 {
    check for %p
    } -setup {
    } -constraints {
    } -cleanup {

    } -body {
    set a [logger::utils::createFormatCmd %p -category test::cat -priority error] 
    set b [subst $a]
    } -returnCodes {
        ok
    } -result error


    ::tcltest::test createLogProc-1 {
    create a proc and test it
    } -setup {
    } -constraints {
    } -cleanup {


    } -body {
    set a [logger::utils::createLogProc \
           -category catTest \
           -priority critical \
           -procName ::bobo \
           -conversionPattern {\[%d\] \[%c\] \[%M\] \[%p\] %m}]
    eval $a

    ::bobo test
    } -returnCodes {ls

    ok
    }  -match regexp \
    -output {\[[\d:\/ ]+\] \[catTest\] \[namespace\] \[critical\] test}










    ::tcltest::test applyAppender-1 {
    apply an appender 
    } -setup {
    } -constraints {








    } -cleanup {








    ${log}::delete
    unset log

    } -body {
    set log [logger::init testLog]
    logger::utils::applyAppender -appender console -serviceCmd $log

    ${log}::error "this is error"
    } -returnCodes {
        ok

    }  -match regexp \
    -output {\[[\d:\/ ]+\] \[testLog\] \[namespace\] \[error\] this is error}

    ::tcltest::test applyAppender-2 {
    apply an appender, to 2 loggers
    } -setup {
    } -constraints {
    } -cleanup {
    ${log1}::delete
    ${log2}::delete
    unset log1
    unset log2

    } -body {
    set log1 [logger::init testLog1]
    set log2 [logger::init testLog2]
    logger::utils::applyAppender -appender console -serviceCmd [list $log1 $log2]

    ${log1}::error "this is error1"
    ${log2}::error "this is error2"
    } -returnCodes {
        ok
    }  -match regexp \
    -output {\[[\d:\/ ]+\] \[testLog1\] \[namespace\] \[error\] this is error1\n\[[\d:\/ ]+\] \[testLog2\] \[namespace\] \[error\] this is error2}



    ::tcltest::test applyAppender-3 {


    auto apply
    } -setup {
    } -constraints {
    } -cleanup {
    } -body {
    logger::utils::applyAppender -appender console
    set log [logger::init applyAppender-3]

    ${log}::error "this is error"
    } -returnCodes {
        ok

    } -match regexp \
    -output {\[[\d:\/ ]+\] \[applyAppender-3\] \[namespace\] \[error\] this is error}

    ::tcltest::test applyAppender-4 {
    auto apply
    } -setup {
    } -constraints {
    } -cleanup {



    } -body {
    logger::utils::applyAppender -appender colorConsole
    set log [logger::init applyAppender-4]

    ${log}::error "this is error"
    } -returnCodes {
        ok

    } -match regexp \
    -output {\[[\d:\/ ]+\] \[applyAppender-4\] \[namespace\] \[error\] this is error}

    ::tcltest::test applyAppender-5 {
    auto apply fileAppend
    } -setup {
    } -constraints {
    } -cleanup {



    } -body {
    logger::utils::applyAppender \

        -appender fileAppend -appenderArgs {-outputChannel stderr}
    set log [logger::init applyAppender-5]

    ${log}::error "this is error"
    } -returnCodes {
    ok
    } -match regexp \
    -errorOutput {\[[\d:\/ ]+\] \[applyAppender-5\] \[namespace\] \[error\] this is error}
    



}


testsuiteCleanup


# ;;; Local Variables: ***
# ;;; mode: tcl ***
# ;;; End: ***






<
<







 








|
<
>
|
|
<
<
<
<
<
<
<

>

|
<
<
<
<
>
|

|

|

|
<
<
<
<
>
|


<
<
|

|
<
<
<
<
>
|


<
<
|

|
<
<
<
<
>
|


<
<
|

|
<
<
<
<
>
|


<
<
|

|
<
<
<
<
>
|


<
<
|

<
|
<
<
<
<
>
>
|
|
|
|
|
|
<
>
|
<
|
<
<
|

>
>
>
>
>
>
>
>
>
|
|
<
<
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>


>
|


>
|
<
<
>
|
<

|
<
<
<
<




>
|



>
|
|
<
<
<
<
|
>

|
>
>
|
<
<
<
|


>
|
<
<
>
|
<

|
<
<
<
<
>
>
>
|


>
|
<
<
>
|
<

|
<
<
<
<
>
>
>
|

>
|

>
|
<
<
<
<
|
>

>
|
<
<

<
>



1
2
3
4
5
6
7


8
9
10
11
12
13
14
..
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


158
159

160
161




162
163
164
165
166
167
168
169


170
171

172
173




174
175
176
177
178
179
180
181
182
183




184
185
186
187
188


189

190
191
192
193
# -*- tcl -*-
# Tests for the utilities to the logger facility.
#
# Sourcing this file into Tcl runs the tests and generates output for errors.
# No output means no errors were found.
#
# Copyright (c) 2005 by Aamer Aahkter



# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

................................................................................
testing {
    useLocal loggerUtils.tcl logger::utils
}

# -------------------------------------------------------------------------

logger::setlevel debug

proc msg {name {suffix {}}} {

    lappend map @ $name ! $suffix
    return [string map $map {\[[\d:\/ ]+\] \[@\] \[namespace\] \[error\] this is error!}]
}








# -------------------------------------------------------------------------

::tcltest::test createFormatCmd-1 {check for %d} -cleanup {




    unset a b
} -body {
    set a [logger::utils::createFormatCmd %d]
    set b [subst $::a]
    regexp {\d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d} $b
} -result {1}

::tcltest::test createFormatCmd-2 {check for %P} -cleanup {




    unset a b
} -body {
    set a [logger::utils::createFormatCmd %P]
    set b [subst $a]


} -result [pid]

::tcltest::test createFormatCmd-3 {check for %H} -cleanup {




    unset a b
} -body {
    set a [logger::utils::createFormatCmd %H]
    set b [subst $a]


} -result [info hostname]

::tcltest::test createFormatCmd-4 {check for %c} -cleanup {




    unset a b
} -body {
    set a [logger::utils::createFormatCmd %c -category test::cat ] 
    set b [subst $a]


} -result test::cat

::tcltest::test createFormatCmd-5 {check for %C} -cleanup {




    unset a b
} -body {
    set a [logger::utils::createFormatCmd %C -category test::cat ] 
    set b [subst $a]


} -result test

::tcltest::test createFormatCmd-6 {check for %p} -cleanup {




    unset a b
} -body {
    set a [logger::utils::createFormatCmd %p -category test::cat -priority error] 
    set b [subst $a]


} -result error


::tcltest::test createLogProc-1 {create a proc and test it} -cleanup {




    rename ::bobo {}
    namespace delete ::loggerExtension::test
} -body {
    eval [logger::utils::createLogProc \
	      -category catTest \
	      -priority critical \
	      -procName ::bobo \
	      -conversionPattern {\[%d\] \[%c\] \[%M\] \[%p\] %m}]

    namespace eval ::loggerExtension::test {
	::bobo test

    }


}  -match regexp -output {\[[\d:\/ ]+\] \[catTest\] \[namespace\] \[critical\] test}


::tcltest::test createLogProc-2 {tkt e4d5ef01e7, %M OO context} -constraints tcl8.5plus -setup {
    package require TclOO
    ::oo::class create Main {
	variable log
	constructor {} {
	    set this_inst [namespace current]
	    set this_klaz [info object class $this_inst]
	    set log [::logger::init $this_klaz]
	    ::logger::utils::applyAppender \
		-appender "console" \


		-appenderArgs {-conversionPattern {%d \[%p\] \[%M\] %m}} \
		-serviceCmd $log
	}
	method invoke {} {
	    ${log}::info "hello"
	}
    }
    set main [Main new]
} -cleanup {
    $main destroy
    unset main
    Main destroy
} -body {
    $main invoke
} -match regexp -output {[\d:\/ ]+ \[info\] \[::Main::invoke\] hello}

::tcltest::test applyAppender-1 {apply an appender} -cleanup {
    ${log}::delete
    unset log
    namespace delete ::loggerExtension::test
} -body {
    set log [logger::init testLog]
    logger::utils::applyAppender -appender console -serviceCmd $log
    namespace eval ::loggerExtension::test {
	${::log}::error "this is error"


    }
} -match regexp -output [msg testLog]


::tcltest::test applyAppender-2 {apply an appender, to 2 loggers} -cleanup {




    ${log1}::delete
    ${log2}::delete
    unset log1
    unset log2
    namespace delete ::loggerExtension::test
} -body {
    set log1 [logger::init testLog1]
    set log2 [logger::init testLog2]
    logger::utils::applyAppender -appender console -serviceCmd [list $log1 $log2]
    namespace eval ::loggerExtension::test {
	${::log1}::error "this is error1"
	${::log2}::error "this is error2"




    }
} -match regexp -output [msg testLog1 1]\n[msg testLog2 2]

::tcltest::test applyAppender-3 {auto apply} -cleanup {
    ${log}::delete
    unset log
    namespace delete ::loggerExtension::test



} -body {
    logger::utils::applyAppender -appender console
    set log [logger::init applyAppender-3]
    namespace eval ::loggerExtension::test {
	${::log}::error "this is error"


    }
} -match regexp -output [msg applyAppender-3]


::tcltest::test applyAppender-4 {auto apply} -cleanup {




    ${log}::delete
    unset log
    namespace delete ::loggerExtension::test
} -body {
    logger::utils::applyAppender -appender colorConsole
    set log [logger::init applyAppender-4]
    namespace eval ::loggerExtension::test {
	${::log}::error "this is error"


    }
} -match regexp -output [msg applyAppender-4]


::tcltest::test applyAppender-5 {auto apply fileAppend} -cleanup {




    ${log}::delete
    unset log
    namespace delete ::loggerExtension::test
} -body {
    logger::utils::applyAppender \
	-appender fileAppend \
	-appenderArgs {-outputChannel stderr}
    set log [logger::init applyAppender-5]
    namespace eval ::loggerExtension::test {
	${::log}::error "this is error"




    }
} -match regexp -errorOutput [msg applyAppender-5]

# -------------------------------------------------------------------------



testsuiteCleanup

return
# ;;; Local Variables: ***
# ;;; mode: tcl ***
# ;;; End: ***

Changes to modules/log/logger_trace.test.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Tests for the logger facility.
#
# Sourcing this file into Tcl runs the tests and generates output for errors.
# No output means no errors were found.
#
# Copyright (c) 2002 by David N. Welton <[email protected]>.
# Copyright (c) 2004,2005 by Michael Schlenker <[email protected]>.
#
# $Id: logger_trace.test,v 1.2 2006/10/09 21:41:41 andreas_kupries Exp $

# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]







<
<







2
3
4
5
6
7
8


9
10
11
12
13
14
15
# Tests for the logger facility.
#
# Sourcing this file into Tcl runs the tests and generates output for errors.
# No output means no errors were found.
#
# Copyright (c) 2002 by David N. Welton <[email protected]>.
# Copyright (c) 2004,2005 by Michael Schlenker <[email protected]>.



# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

Changes to modules/log/loggerperformance.

1
2
3
4
5
6
7
8
9
10
11
12
# -*- tcl -*-
# loggerperformance.tcl

# $Id: loggerperformance,v 1.2 2004/01/15 06:36:13 andreas_kupries Exp $

# This code is for benchmarking the performance of the log tools.

set auto_path "[file dirname [info script]] $auto_path"
package require logger
package require log

# Set up logger

|
<
<







1
2
3


4
5
6
7
8
9
10
# -*- tcl -*-
# loggerperformance.tcl
#


# This code is for benchmarking the performance of the log tools.

set auto_path "[file dirname [info script]] $auto_path"
package require logger
package require log

# Set up logger

Changes to modules/log/pkgIndex.tcl.

2
3
4
5
6
7
8
9
package ifneeded log 1.4 [list source [file join $dir log.tcl]]

if {![package vsatisfies [package provide Tcl] 8.2]} {return}
package ifneeded logger           0.9.4 [list source [file join $dir logger.tcl]]
package ifneeded logger::appender 1.3   [list source [file join $dir loggerAppender.tcl]]

if {![package vsatisfies [package provide Tcl] 8.4]} {return}
package ifneeded logger::utils    1.3   [list source [file join $dir loggerUtils.tcl]]






|
2
3
4
5
6
7
8
9
package ifneeded log 1.4 [list source [file join $dir log.tcl]]

if {![package vsatisfies [package provide Tcl] 8.2]} {return}
package ifneeded logger           0.9.4 [list source [file join $dir logger.tcl]]
package ifneeded logger::appender 1.3   [list source [file join $dir loggerAppender.tcl]]

if {![package vsatisfies [package provide Tcl] 8.4]} {return}
package ifneeded logger::utils    1.3.1 [list source [file join $dir loggerUtils.tcl]]