LoggerInterface inspired by PHP PSR-3
LoggerInterface.h@4:96f938f3d98a, 2017-04-02 (annotated)
- Committer:
- Sille Van Landschoot
- Date:
- Sun Apr 02 13:02:48 2017 +0200
- Revision:
- 4:96f938f3d98a
- Parent:
- 1:8ee5fd3c1bf1
- Child:
- 6:015483427bd3
add pragma once to h file
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sille Van Landschoot |
4:96f938f3d98a | 1 | #pragma once |
sillevl | 0:13d1767f0c98 | 2 | |
sillevl | 1:8ee5fd3c1bf1 | 3 | namespace Log{ |
sillevl | 0:13d1767f0c98 | 4 | |
sillevl | 0:13d1767f0c98 | 5 | class LoggerInterface |
sillevl | 0:13d1767f0c98 | 6 | { |
sillevl | 0:13d1767f0c98 | 7 | public: |
Sille Van Landschoot |
4:96f938f3d98a | 8 | |
sillevl | 1:8ee5fd3c1bf1 | 9 | enum Level {EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG}; |
Sille Van Landschoot |
4:96f938f3d98a | 10 | |
sillevl | 0:13d1767f0c98 | 11 | /** |
sillevl | 0:13d1767f0c98 | 12 | * System is unusable. |
sillevl | 0:13d1767f0c98 | 13 | * |
sillevl | 0:13d1767f0c98 | 14 | * @param string $message |
sillevl | 0:13d1767f0c98 | 15 | */ |
sillevl | 1:8ee5fd3c1bf1 | 16 | virtual void emergency(char* message, ...) = 0; |
sillevl | 0:13d1767f0c98 | 17 | |
sillevl | 0:13d1767f0c98 | 18 | /** |
sillevl | 0:13d1767f0c98 | 19 | * Action must be taken immediately. |
sillevl | 0:13d1767f0c98 | 20 | * |
sillevl | 0:13d1767f0c98 | 21 | * Example: Entire website down, database unavailable, etc. This should |
sillevl | 0:13d1767f0c98 | 22 | * trigger the SMS alerts and wake you up. |
sillevl | 0:13d1767f0c98 | 23 | * |
sillevl | 0:13d1767f0c98 | 24 | * @param string $message |
sillevl | 0:13d1767f0c98 | 25 | */ |
sillevl | 1:8ee5fd3c1bf1 | 26 | virtual void alert(char* message, ...) = 0; |
sillevl | 0:13d1767f0c98 | 27 | |
sillevl | 0:13d1767f0c98 | 28 | /** |
sillevl | 0:13d1767f0c98 | 29 | * Critical conditions. |
sillevl | 0:13d1767f0c98 | 30 | * |
sillevl | 0:13d1767f0c98 | 31 | * Example: Application component unavailable, unexpected exception. |
sillevl | 0:13d1767f0c98 | 32 | * |
sillevl | 0:13d1767f0c98 | 33 | * @param string $message |
sillevl | 0:13d1767f0c98 | 34 | */ |
sillevl | 1:8ee5fd3c1bf1 | 35 | virtual void critical(char* message, ...) = 0; |
sillevl | 0:13d1767f0c98 | 36 | |
sillevl | 0:13d1767f0c98 | 37 | /** |
sillevl | 0:13d1767f0c98 | 38 | * Runtime errors that do not require immediate action but should typically |
sillevl | 0:13d1767f0c98 | 39 | * be logged and monitored. |
sillevl | 0:13d1767f0c98 | 40 | * |
sillevl | 0:13d1767f0c98 | 41 | * @param string $message |
sillevl | 0:13d1767f0c98 | 42 | */ |
sillevl | 1:8ee5fd3c1bf1 | 43 | virtual void error(char* message, ...) = 0; |
sillevl | 0:13d1767f0c98 | 44 | |
sillevl | 0:13d1767f0c98 | 45 | /** |
sillevl | 0:13d1767f0c98 | 46 | * Exceptional occurrences that are not errors. |
sillevl | 0:13d1767f0c98 | 47 | * |
sillevl | 0:13d1767f0c98 | 48 | * Example: Use of deprecated APIs, poor use of an API, undesirable things |
sillevl | 0:13d1767f0c98 | 49 | * that are not necessarily wrong. |
sillevl | 0:13d1767f0c98 | 50 | * |
sillevl | 0:13d1767f0c98 | 51 | * @param string $message |
sillevl | 0:13d1767f0c98 | 52 | */ |
sillevl | 1:8ee5fd3c1bf1 | 53 | virtual void warning(char* message, ...) = 0; |
sillevl | 0:13d1767f0c98 | 54 | |
sillevl | 0:13d1767f0c98 | 55 | /** |
sillevl | 0:13d1767f0c98 | 56 | * Normal but significant events. |
sillevl | 0:13d1767f0c98 | 57 | * |
sillevl | 0:13d1767f0c98 | 58 | * @param string $message |
sillevl | 0:13d1767f0c98 | 59 | */ |
sillevl | 1:8ee5fd3c1bf1 | 60 | virtual void notice(char* message, ...) = 0; |
sillevl | 0:13d1767f0c98 | 61 | |
sillevl | 0:13d1767f0c98 | 62 | /** |
sillevl | 0:13d1767f0c98 | 63 | * Interesting events. |
sillevl | 0:13d1767f0c98 | 64 | * |
sillevl | 0:13d1767f0c98 | 65 | * Example: User logs in, SQL logs. |
sillevl | 0:13d1767f0c98 | 66 | * |
sillevl | 0:13d1767f0c98 | 67 | * @param string $message |
sillevl | 0:13d1767f0c98 | 68 | */ |
sillevl | 1:8ee5fd3c1bf1 | 69 | virtual void info(char* message, ...) = 0; |
sillevl | 0:13d1767f0c98 | 70 | |
sillevl | 0:13d1767f0c98 | 71 | /** |
sillevl | 0:13d1767f0c98 | 72 | * Detailed debug information. |
sillevl | 0:13d1767f0c98 | 73 | * |
sillevl | 0:13d1767f0c98 | 74 | * @param string $message |
sillevl | 0:13d1767f0c98 | 75 | */ |
sillevl | 1:8ee5fd3c1bf1 | 76 | virtual void debug(char* message, ...) = 0; |
sillevl | 0:13d1767f0c98 | 77 | |
sillevl | 0:13d1767f0c98 | 78 | /** |
sillevl | 0:13d1767f0c98 | 79 | * Logs with an arbitrary level. |
sillevl | 0:13d1767f0c98 | 80 | * |
sillevl | 0:13d1767f0c98 | 81 | * @param mixed $level |
sillevl | 0:13d1767f0c98 | 82 | * @param string $message |
sillevl | 0:13d1767f0c98 | 83 | */ |
sillevl | 1:8ee5fd3c1bf1 | 84 | virtual void log(Level level, char* message, ...) = 0; |
sillevl | 1:8ee5fd3c1bf1 | 85 | }; |
sillevl | 1:8ee5fd3c1bf1 | 86 | |
Sille Van Landschoot |
4:96f938f3d98a | 87 | } |