Dr-B / advanced-shell-history

Automatically exported from code.google.com/p/advanced-shell-history
Apache License 2.0
0 stars 0 forks source link

Feature Request - Logging to ERROR or FATAL should also output to stderr #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
For developing this code, it would be nice to see important debugging messages 
right away, without having to open the log file.  However, I would like to keep 
the messages in the log file as well.

I want to see a new config options: ASH_CFG_LOG_STDERR_LEVEL which sets a 
logging visibility threshold that determines whether a message is logged to 
stderr or not.

This is in addition to the logging threshold that determines whether a message 
is logged to file.

Ideally, I would set my to-file threshold to be something like INFO and my 
to-stderr level to be something like WARNING.  That way, while using a 
developmental release I can see warnings and errors right away but while also 
maintaing a more detailed set of debugging info in a file.

The problem with the existing code is that the Logger inserts some data into a 
ofstream and then returns it to the caller.  At that point the caller can 
insert a message (or messages) at will.  The Logging code loses control of the 
ostream.

What is needed is some kind of proxy ostream that contains two ostreams - one 
open to the file and the other open to stderr.  Instead of returning the 
ostream to the file, we would return this proxy and whenever something is 
inserted, we just check the various logging thresholds to determine whether to 
insert the message into the appropriate streams.

Original issue reported on code.google.com by carl.and...@gmail.com on 27 Sep 2011 at 3:54

GoogleCodeExporter commented 9 years ago
This could be done by changing the flag parsing library to use the Google 
gflags library: http://code.google.com/p/gflags/

This may also solve the stdlib segfault issue since my flag library is the 
source of the crash.

Original comment by carl.and...@gmail.com on 30 Jul 2012 at 3:52