From: John Torjo (john.lists_at_[hidden])
Date: 2005-05-22 00:18:53
> I hope I'm allowed more than one... Actually all the use cases I can
Of course you're allowed ;) The more the better!
> SCENARIO A: socket server
> I define ERROR, WARN and INFO and all go in the same big log file.
> Timestamp automatically prefixed. Three tab-separated fields (i.e.
> timestamp, level, message).
> It is always there in production code.
> How it needs to be improved:
> 1. Be able to hide info, or info and warn lines when viewing the log
> file. Alternatively write each level to its own log file, and have a
> viewer that is able to combine the three files (I.e. typical usage is I
> want to see what INFO/WARN messages led to an ERROR message). Any viewer
> must work on Windows and linux.
This can all be done from an external viewer. I've developed something
like this -- unfortunately did not have time for improving it lately.
It's Windows-only unfortunately.
> 2. Daily log rotation, with YYYYMMDD style datestamp going into the
> filename. If hourly log rotation then YYYYMMDD_HHMMSS style datestamp in
> the filename.
Should be possible with the latest version.
> (I also want logs older than N days to be gzipped, and log older than
> a certain date to be deleted; but I'm happy - in fact happier - for
> these tasks to be done by cron job not a logging library, as it is a
> system administrators decision not a programmers decision)
Let's leave it to the admin for now ;)
> 3. Be able to start/stop a DEBUG level while the program is running.
> 4. Email me when an ERROR message occurs. Different levels of error
> could go to different email addresses (i.e. more serious ones need to go
> to a mobile email address).
Doable with the current lib (if you write your appender which sends email).
By the way, if anybody has written something like this and wants to
share, I'd appreciate sending it to me.
> SCENARIO B: debugging game tree search
> The LOG macro must be able to be compiled out completely. This is code
> that once debugged and compiled in release mode should take a fraction
> of a second to run.
> What I want that I don't have: Instead of writing to a log file, I want
> to write to a memory buffer, that only stores the last 2MB, or the last
> 100 messages, for instance.
Yes, Pavel Vozelinek suggested I do an appender over shmem lib. I should
indeed do so.
> Then when I have an assert I want to be able to output the contents of
> that buffer. E.g.
> SMART_ASSERT(node_cnt<5000 &&
> can it be thinking to search so deeply?");
> In-memory is important as writing to a disk file is a major performance
Yup, to do.
-- John Torjo, Contributing editor, C/C++ Users Journal -- "Win32 GUI Generics" -- generics & GUI do mix, after all -- http://www.torjo.com/win32gui/ -v1.6.3 (Resource Splitter) -- http://www.torjo.com/cb/ - Click, Build, Run!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk