Serial output logger based on the LoggerInterface
Fork of LogIt by
loggers/serial_logger.h@4:9c5143891c8a, 2016-12-14 (annotated)
- Committer:
- Nico De Witte
- Date:
- Wed Dec 14 18:06:34 2016 +0100
- Revision:
- 4:9c5143891c8a
Refactor LogIt to SerialLogger and also add Logable interface and NullLogger.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nico De Witte |
4:9c5143891c8a | 1 | #pragma once |
Nico De Witte |
4:9c5143891c8a | 2 | |
Nico De Witte |
4:9c5143891c8a | 3 | #include "LoggerInterface.h" |
Nico De Witte |
4:9c5143891c8a | 4 | #include "mbed.h" |
Nico De Witte |
4:9c5143891c8a | 5 | |
Nico De Witte |
4:9c5143891c8a | 6 | namespace LogIt { |
Nico De Witte |
4:9c5143891c8a | 7 | |
Nico De Witte |
4:9c5143891c8a | 8 | class SerialLogger : public Log::LoggerInterface |
Nico De Witte |
4:9c5143891c8a | 9 | { |
Nico De Witte |
4:9c5143891c8a | 10 | public: |
Nico De Witte |
4:9c5143891c8a | 11 | SerialLogger(Serial* serial); |
Nico De Witte |
4:9c5143891c8a | 12 | void emergency(const char * message, ...); |
Nico De Witte |
4:9c5143891c8a | 13 | void alert(const char * message, ...); |
Nico De Witte |
4:9c5143891c8a | 14 | void critical(const char * message, ...); |
Nico De Witte |
4:9c5143891c8a | 15 | void error(const char * message, ...); |
Nico De Witte |
4:9c5143891c8a | 16 | void warning(const char * message, ...); |
Nico De Witte |
4:9c5143891c8a | 17 | void notice(const char * message, ...); |
Nico De Witte |
4:9c5143891c8a | 18 | void info(const char * message, ...); |
Nico De Witte |
4:9c5143891c8a | 19 | void debug(const char * message, ...); |
Nico De Witte |
4:9c5143891c8a | 20 | void log(Level level, const char * message, ...); |
Nico De Witte |
4:9c5143891c8a | 21 | |
Nico De Witte |
4:9c5143891c8a | 22 | void setLevel(Level level); |
Nico De Witte |
4:9c5143891c8a | 23 | |
Nico De Witte |
4:9c5143891c8a | 24 | protected: |
Nico De Witte |
4:9c5143891c8a | 25 | Serial* serial; |
Nico De Witte |
4:9c5143891c8a | 26 | Level level; // minimum level to log |
Nico De Witte |
4:9c5143891c8a | 27 | |
Nico De Witte |
4:9c5143891c8a | 28 | private: |
Nico De Witte |
4:9c5143891c8a | 29 | void log(Level level, const char * message, va_list args); |
Nico De Witte |
4:9c5143891c8a | 30 | }; |
Nico De Witte |
4:9c5143891c8a | 31 | |
Nico De Witte |
4:9c5143891c8a | 32 | }; |