Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
question about logger and logging to a file
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
marc spitzer  
View profile  
 More options Nov 20 2009, 5:20 pm
Newsgroups: comp.lang.tcl
From: marc spitzer <ms4...@sdf.lonestar.org>
Date: Fri, 20 Nov 2009 22:20:55 +0000 (UTC)
Local: Fri, Nov 20 2009 5:20 pm
Subject: question about logger and logging to a file
I am trying to get logger to log to a file and found the below on
the wiki at: http://wiki.tcl.tk/6893

my question is this the corret/prefered way to do this?

A basic example of logging to a file:

 package require logger
 proc log_to_file {lvl txt} {
   set logfile "mylog.log"
   set msg "\[[clock format [clock seconds]]\] $txt"
   set f [open $logfile {WRONLY CREAT APPEND}] ;# instead of "a"
   fconfigure $f -encoding utf-8
   puts $f $msg
   close $f
 }

 set log [logger::init global]
 foreach lvl [logger::levels] {
   interp alias {} log_to_file_$lvl {} log_to_file $lvl
   ${log}::logproc $lvl log_to_file_$lvl
 }

 ${log}::info "Logging to a file"

thanks,

marc
--
ms4...@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google