LoggerInterface inspired by PHP PSR-3

Dependents:   LogIt

LoggerInterface.h

Committer:
sillevl
Date:
2016-11-24
Revision:
1:8ee5fd3c1bf1
Parent:
0:13d1767f0c98
Child:
2:97f331aa4938
Child:
3:f1457069237f
Child:
4:96f938f3d98a

File content as of revision 1:8ee5fd3c1bf1:


namespace Log{

class LoggerInterface
{
    public:
    
    enum Level {EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG};
    
    /**
     * System is unusable.
     *
     * @param string $message
     */
    virtual void emergency(char* message, ...) = 0;

    /**
     * Action must be taken immediately.
     *
     * Example: Entire website down, database unavailable, etc. This should
     * trigger the SMS alerts and wake you up.
     *
     * @param string $message
     */
    virtual void alert(char* message, ...) = 0;

    /**
     * Critical conditions.
     *
     * Example: Application component unavailable, unexpected exception.
     *
     * @param string $message
     */
    virtual void critical(char* message, ...) = 0;

    /**
     * Runtime errors that do not require immediate action but should typically
     * be logged and monitored.
     *
     * @param string $message
     */
    virtual void error(char* message, ...) = 0;

    /**
     * Exceptional occurrences that are not errors.
     *
     * Example: Use of deprecated APIs, poor use of an API, undesirable things
     * that are not necessarily wrong.
     *
     * @param string $message
     */
    virtual void warning(char* message, ...) = 0;

    /**
     * Normal but significant events.
     *
     * @param string $message
     */
    virtual void notice(char* message, ...) = 0;

    /**
     * Interesting events.
     *
     * Example: User logs in, SQL logs.
     *
     * @param string $message
     */
    virtual void info(char* message, ...) = 0;

    /**
     * Detailed debug information.
     *
     * @param string $message
     */
    virtual void debug(char* message, ...) = 0;

    /**
     * Logs with an arbitrary level.
     *
     * @param mixed $level
     * @param string $message
     */
    virtual void log(Level level, char* message, ...) = 0;
};

}