From: Andreas K. <aku...@sh...> - 2006-04-13 03:16:47
|
Hi. Enclosed a tcl procedure I find very convenient to create a logger service coupled directly to a specific namespace. Service name and namespace name are identical (modulo :: for full qualification), and the log commands are directly acessible in the the namespace. _________________________________________________________ proc logutil {ns} { set service [string trimleft $ns :] namespace eval $ns [list logger::init $service] namespace eval $ns [list logger::import -force \ -all -namespace log $service] return } _________________________________________________________ Use namespace eval ::foo::bar::blech logutil ::foo::bar::blech Right now I have this command in a mini package of its own, however I believe that having it in logger itself would be better. Haven't found a real good name for it yet however. So far only logger::initNamespace logger::setupServiceInNamespace ... Other ideas and opinions ? -- So long, Andreas Kupries <aku...@sh...> <http://www.purl.org/NET/akupries/> Developer @ <http://www.activestate.com/> ------------------------------------------------------------------------------- |