Home » Developing U++ » UppHub » Extended Logging Package
Extended Logging Package [message #17275] |
Tue, 05 August 2008 14:31  |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
I created a package to extend the logging capabilities of Upp. I encountered a situation where I wanted to use custom log files for release programs to log Successful and Failed transfers. It is built as a singleton with lazy creation. I built it with an archiving capability so it uses Upp bz2 package to archive logs older than a user-defined time frame. There are special cases for debug and release logs so that the archiving and dating capabilities can also apply to them. Finally, there is some Topic++ documentation for it, but the in-code documentation in the header file is best. Let me know what you think.
Simple Example:void QuickExample(){
// Logger singleton instance created automatically and lazily on first use.
UppLog::LOGGER->BeginLogs();
UppLog::LOGGER->EnableCout(UppLog::RELEASE);
UppLog::UPPLOG(UppLog::BOTH, "This message is sent to both log files.");
UppLog::UPPLOG(UppLog::DEBUG, "This message is sent to debug log.");
UppLog::UPPLOG(UppLog::RELEASE, "This message is sent to release log (and Cout()).");
UppLog::LOGGER->CreateLog("Successes");
UppLog::LOGGER->CreateLog("Failures", "C:\\failures");
UppLog::UPPLOG("Successes", "My successful transaction message.");
UppLog::UPPLOG("Failures", "My failed transaction message.");
};
Edit: Attachment deleted. Use the newer version below.
[Updated on: Tue, 23 September 2008 19:16] Report message to a moderator
|
|
|
|
|
Re: Extended Logging Package [message #17290 is a reply to message #17279] |
Tue, 05 August 2008 18:42  |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
Changed macros to inline void functions.
Fixed bug in calculating getting seconds from time interval.
Changed massage arguments to const string references.
Sample using namespace:
using namespace UppLog;
Logger::Instance()->BeginLogs();
UPPLOG(BOTH, "log message");
|
|
|
Goto Forum:
Current Time: Sat Apr 26 20:37:13 CEST 2025
Total time taken to generate the page: 0.01297 seconds
|