LoggerInterface inspired by PHP PSR-3

Dependents:   LogIt

Fork of LoggerInterface by Sille Van Landschoot

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LoggerInterface.h Source File

LoggerInterface.h

00001 #pragma once
00002 
00003 namespace Log{
00004 
00005 class LoggerInterface
00006 {
00007     public:
00008 
00009     enum Level {EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG};
00010 
00011     /**
00012      * System is unusable.
00013      *
00014      * @param string $message
00015      */
00016     virtual void emergency(const char * message, ...) = 0;
00017 
00018     /**
00019      * Action must be taken immediately.
00020      *
00021      * Example: Entire website down, database unavailable, etc. This should
00022      * trigger the SMS alerts and wake you up.
00023      *
00024      * @param string $message
00025      */
00026     virtual void alert(const char * message, ...) = 0;
00027 
00028     /**
00029      * Critical conditions.
00030      *
00031      * Example: Application component unavailable, unexpected exception.
00032      *
00033      * @param string $message
00034      */
00035     virtual void critical(const char * message, ...) = 0;
00036 
00037     /**
00038      * Runtime errors that do not require immediate action but should typically
00039      * be logged and monitored.
00040      *
00041      * @param string $message
00042      */
00043     virtual void error(const char * message, ...) = 0;
00044 
00045     /**
00046      * Exceptional occurrences that are not errors.
00047      *
00048      * Example: Use of deprecated APIs, poor use of an API, undesirable things
00049      * that are not necessarily wrong.
00050      *
00051      * @param string $message
00052      */
00053     virtual void warning(const char * message, ...) = 0;
00054 
00055     /**
00056      * Normal but significant events.
00057      *
00058      * @param string $message
00059      */
00060     virtual void notice(const char * message, ...) = 0;
00061 
00062     /**
00063      * Interesting events.
00064      *
00065      * Example: User logs in, SQL logs.
00066      *
00067      * @param string $message
00068      */
00069     virtual void info(const char * message, ...) = 0;
00070 
00071     /**
00072      * Detailed debug information.
00073      *
00074      * @param string $message
00075      */
00076     virtual void debug(const char * message, ...) = 0;
00077 
00078     /**
00079      * Logs with an arbitrary level.
00080      *
00081      * @param mixed $level
00082      * @param string $message
00083      */
00084     virtual void log(Level level, const char * message, ...) = 0;
00085 };
00086 
00087 }