commit c758c43671f604a7bc694b5f832fbdf544b6e276 from: TheLion date: Thu Jul 06 01:02:50 2023 UTC docs: update readme commit - c62b38f80091d571afd282be4822856bc16581c8 commit + c758c43671f604a7bc694b5f832fbdf544b6e276 blob - a192768c75e2dd7ccb3d76482f2bbe3136835a1e blob + 1ababa0d3f534edc8b95512bbcf48edca76ed90c --- README.md +++ README.md @@ -51,3 +51,29 @@ result: 2023-07-02 19:21:54 [WARN] main test.pl warn 2023-07-02 19:21:54 [ERROR] main test.pl error ``` + +### sugar vs json + +there are two options to print logs: +* sugar +* JSON + +JSON logging is meant for being picked up by services such as grafana or the elk stack. +Sugar logging is meant for human readable output to stdout. + +example of JSON: +``` +{ "level": "DEBUG", "msg": "debug", "package": "main", "file": "test.pl:12" } +{ "level": "INFO", "msg": "info", "package": "main", "file": "test.pl:13" } +{ "level": "WARN", "msg": "warn", "package": "main", "file": "test.pl:14" } +{ "level": "ERROR", "msg": "error", "package": "main", "file": "test.pl:15" } +``` + +example of Sugar: +``` +2023-07-02 19:22:03 [DEBUG] main test.pl:12 debug +2023-07-02 19:22:03 [INFO ] main test.pl:13 info +2023-07-02 19:22:03 [WARN ] main test.pl:14 warn +2023-07-02 19:22:03 [ERROR] main test.pl:15 error +``` +