[Live-devel] [PATCH] Enable logging levels, part1

David Stegbauer david.stegbauer at acision.com
Thu Jul 1 03:44:09 PDT 2010


Hi Ross,

attached please find patch which enables logging levels. It is diff against 
live.2010.06.22. It is tested.

Please let me know whether you accept this patch or if it should be improved 
or if you deny it (I'd like to know why in this case).

Motivation:

There are many calls in form envir() << something; or similar. These messages 
are either emitted or could be completely disabled by subclassing 
[Basic]UsageEnvironment. There is nothing in between, however some are just 
debug ones and others are warnings or even errors.
I think there should be more fine grained control. It also should be possible 
(but not required) to log messages using 3rd party logging frameworks (for 
example rLog or glog).

Overview:

Actual patch (part 1) is compatible with old code and makes minimum changes. 
Old code will continue to work.
Next patch (if this one will be accepted) will remove operator<< form 
UsageEnvironment and will modify envir() << something; to envir().log(level) 
<< something;

Implementation (in the attached patch):

UsageEnvironment.hh , UsageEnvironment.cpp:
Class Logger accepts usual log levels. It defines operator<< the same way as 
UsageEnvironment does. It however is not abstract class, it does just no 
output.
Class UsageEnvironment adds new member (field) fLogger and new method 
log(LogLevel) which returns either current logger (fLogger) or null logger 
(Logger::nullLogger()) based on level.

BasicUsageEnvironment.hh , BasicUsageEnvironment.cpp:
Class BasicLogger defines its operator<< to print values to stderr (as 
BasicUsageEnvironment did) and sets its default log level to print all 
messages.
Class BasicUsageEnvironment redirects processing from its operator<< to its 
method log(...).

Best Regards
David Stegbauer


This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: live555-logger.patch
Type: text/x-patch
Size: 23154 bytes
Desc: live555-logger.patch
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20100701/c1ea3d38/attachment-0001.bin>


More information about the live-devel mailing list