From 39662766347a7e540dd8f5b4d494358e42304539 Mon Sep 17 00:00:00 2001 From: Antranig Vartanian Date: Sun, 15 Jun 2025 06:06:22 +0400 Subject: [PATCH] add README.md with details --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/README.md b/README.md index e69de29..34bfb80 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,72 @@ +# Logger for Vishap Oberon Compiler (voc) + +A minimal, structured logging library for [Vishap Oberon](https://vishap.oberon.am), suitable for CLI programs and system-level Oberon modules. + +## Features +- Outputs to standard output using Out +- Suppress or increase verbosity +- Four log levels: ERROR, WARN, INFO, DEBUG +- ISO 8601 UTC timestamps with Z suffix +- Optional module prefix + + +## Log Format + +Each message follows this format: + +``` +[YYYY-MM-DDTHH:MM:SSZ] [LEVEL] [prefix] message +``` + +The `[prefix]` section is omitted if none is set. + +## Example Output + +``` +[2025-06-15T04:06:38Z] [INFO] Logger initialized +[2025-06-15T04:06:38Z] [INFO] The answer to life, the universe, and everything: 42 +[2025-06-15T04:06:38Z] [WARN] [Web Server] Web Server is loading slowly +[2025-06-15R06:00:03R] [ERROR] [Web Server] Something went wrong... +[2025-06-15R06:00:03R] [DEBUG] [Web Server] File descriptor: 73 +[2025-06-15R06:00:03R] [INFO] Prefix cleared +``` + +## Usage + +``` +MODULE LoggerTest; + IMPORT Logger; +VAR log: Logger.Logger; +BEGIN + log := Logger.New(); + + log.SetLevel(Logger.DEBUG); + log.Info("Program initialized"); + log.InfoInt("The answer to life, the universe, and everything: ", 42); + + log.SetPrefix("Web Server"); + log.Warn("Web Server is loading slowly"); + log.WarnInt("Current threads: ", 4) +END LoggerTest. +``` + +## Building + +``` +make +``` + +## Tests + +``` +make test +``` + +## Dependencies +- For building: `voc` (duh!) +- For testing: `awk` + +## License + +BSD 2-Clause License +