Serial output logger based on the LoggerInterface
Fork of LogIt by
Diff: README.md
- Revision:
- 5:e16468c1160f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Wed Dec 14 19:03:57 2016 +0100 @@ -0,0 +1,39 @@ +# Mbed LogIt + +Logger library that is build based on the LoggerInterface library that follows +the PSR-3 logger standard. + +This library provides an abstract class logable to make your classes easily Logger +aware. + +Besides that the LogIt library also has a SerialLogger implementation and a NullLogger +for production applications where no logging should be done. + +NullLogger is used as a default when making your classes Logger aware. It is implemented +using the Singleton pattern to avoid waste of resources. + +## Using LogIt + +First make your class inherit from Logable as such + +```C++ +class Router : public LogIt::Logable { + //... +}; +``` + +Now you can use the `set_logger()` method to inject a logger into the class +or you can provide it as an optional argument to your constructors as shown below: + +```C++ + Router::Router(int address, Log::LoggerInterface * logger = 0) { + set_logger(logger); + logger->info("Setting up the router"); + //... + } +``` + +## Dependencies + +This library currently only depends on the LoggerInterface itself which can be found at +[https://developer.mbed.org/users/dwini/code/LoggerInterface/](https://developer.mbed.org/users/dwini/code/LoggerInterface/)