From b846fbcd7ccd61ac52d4299d199244dbbaafd258 Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Tue, 28 Feb 2023 11:35:06 +0100 Subject: Add README.md --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0ca050b --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Log library +If you want to filter logs, you need to create a config file named: +`log.config`. And put that in the same level as your application. For example, +if your application is named `foo`, you have a directory structure such as: + +``` +$ ls -1 +foo +log.config +``` + +Add properties in that file such as: +``` +logging.level.= +``` +`TAG` is a tag for the log created in your unit. So you can have multiple logs +in a single file or share the same log in multiple files just using a tag name. + +You can control all logs using: +``` +logging.level= +``` + +## How to create a log +Including file is `log.h`. + +``` +Log *log = log_create("A_TAG"); +``` +Or if you want to bind the log to the file: +``` +Log *log = log_create(__FILE__); +``` +Print logs with: +``` +log_debug(log, "debug log"); +log_info(log, "info log"); +log_warn(log, "warning log"); +log_error(log, "error log"); +``` -- cgit v1.2.3