LogFile modes and ErrorDescription() related changes.

9 views
Skip to first unread message

israel sadeh

unread,
May 24, 2012, 7:57:40 AM5/24/12
to logog...@googlegroups.com

Hi,

 
I hereby attach 3 files with the following suggested changes:
 

Formatter change (in formatter.hpp):

The ErrorDescription() was made virtual. This way its implementation cans be overridden.

I need this option since I added a new level named 'trace' and I would like the overriding implementation of ErrorDescription() to print the new level name.

 
LogFile Changes (In target.hpp and target.cpp):

1) I added a new 'nUsageModes' parameter to the constructor. The parameter has a default value of 0 (i.e.: the change is backwards compatiable), and its value can be any combination of the following bits (defined in a new enum:

 
  • LOG_FILE_CREATE_NEW = 1 : If set, and the file already exists, it is overridden (instead of appended to).
  • LOG_FILE_SHARE_FOR_READ = 2 : If set, the file can be accessed for reading while it is being used by the logger. This flag is relevant only for WINDOWS flavor.
  • LOG_FILE_FLUSH_EACH_WRITE = 4 : If set, the file is flushed after each time it written to (at the end of the Output() method).
2) I removed the member 'm_bFirstTime' and instead of checking its value I check if m_pFile is NULL.

This way it is possible to call the open() method directly instead of waiting for it to be called from the Output() method at the first time it is being called.

 
The attached code was tested on Windows without LOGOG_UNICODE.
 
I would appreciate if it will be integrated with the library’s' code.
 
Thanks,
 
Israel
logog-suggested-changes.zip
Reply all
Reply to author
Forward
0 new messages