Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoogleCodeExporter opened this issue Jul 3, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 27 Sep 2011 at 3:54

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 30 Jul 2012 at 3:52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant