Tk Library Source Code

View Ticket
Login
Ticket UUID: 2381524
Title: RFE: [logger] print all arguments passed to logger API
Type: RFE Version: None
Submitter: hemanglavana Created on: 2008-12-03 07:13:08
Subsystem: log Assigned To: mic42
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2008-12-18 04:52:50
Resolution: Closed By: mic42
    Closed on: 2008-12-17 21:52:25
Description:
The logger package currently prints only the last argument passed to the logger API call. See below:

rtp-lds-016:437> tclsh
% package require logger
0.8
% namespace eval foo {}
% logger::initNamespace ::foo
% foo::log::warn none
[Wed Dec 03 01:49:23 AM EST 2008] [foo] [warn] 'none'
% foo::log::warn two errors
[Wed Dec 03 01:49:37 AM EST 2008] [two] [warn] 'errors'
%                  

It would be nice if the last line above had printed 'two errors' instead of just 'errors'. I suspect there could be some backwards compatibility issues, so it would be fine with me to introduce an API to enable this behavior.
User Comments: mic42 added on 2008-12-18 04:52:50:
Applied the patch with some minor changes. Its now included in the CVS head version 0.9.

mic42 added on 2008-12-18 04:52:25:
Applied the patch with some minor changes. Its now included in the CVS head version 0.9.

hemanglavana added on 2008-12-16 21:19:14:

File Added - 305516: logger.diffs

I am attaching a patch to support printing of multiple arguments passed to logger APIs. The patch ensures that it does not break any of the existing tcltests. Note that the following invocations are now considered equivalent:

${log1}::warn "Danger Will Robinson!"
${log1}::warn Danger Will Robinson!

The output log msg for the above 2 lines will be exactly the same. Earlier, the 2nd call would have only printed "Robinson!".

As for the patch, it has modified the interp alias command to pass additional argument -_logger::service" for child services. This makes it easier to strip out <service> string from the <txt> log message. The _setservice API has been modified to remove the "-_logger::service <service>" strings from $args.

Added 1 tcltest to validate the new scenario.

The version number in the pkgIndex.tcl file will have to be incremented appropriately (patch does not take care of this).


File Added: logger.diffs

Attachments: