m****g 发帖数: 118 | 1 I need some help with a small C++ project since I do not have background in
programming functions such as “Logger”. Any help would be really
appreciated. If you would point me to some tutorial of similar programming
problem will be great!
Problem Description:
You must provide a simple logging framework in C++ that conforms to the
following pseudocode interface:
pLogger
{
LogInfo( message )
LogWarning( message )
LogError( message )
}
Example of code using this logger would be:
FunctionA( pLogger )
{
pLogger->LogInfo( "This is an informational message" )
pLogger->LogWarning( "This is a warning message" )
pLogger->LogError( "This is an error message" )
}
Main()
{
pLogger = BuildLoggerSomehow()
FunctionA( pLogger )
pLogger = BuildLoggerSomeOtherWay()
FunctionA( pLogger )
}
Okay, simple enough in terms of usage. However, we have the following
requirements.
1) Extension Point : Logging Destination
We need to be able to support multiple logging destinations. For example we
would like to be able to have a logger that logs to the standard output, or
to a file, or to a remote server, or to the bit bucket, or whatever
destination is required in the future.
2) Extension Point : Message Format
We need to be able to support multiple message formats. For example:
10:09:56 : WARNING : This is a warning message |
|