#logex: drop-in enhancement of std.log

1 messages · Page 1 of 1 (latest)

median osprey
#

https://github.com/ross-weir/logex

logex is a logging library that provides extensions (logex = log extensions) to zigs std.log, rather than being a replacement of std.log. Projects already using std.log extensively can add it to their project without updating any logging calls and without much effort, just drop it in and call init in your apps entrypoint.

I don't plan to make it a fully featured logging library rather a easy way to add common nice-to-have logging functionality to std.log.

So far:

  • Log to console and/or file, set log levels based on destination which is checked at comptime (like std.log)
  • Multiple formats: basic text, JSON, custom formatting function
  • Implement custom destinations (appenders) for your needs, i.e network or database

To be added:

  • Optionally include timestamps
  • Optionally include thread ids or names
  • Optionally colorize console output
  • Possibly file rotations

Basic getting started example: https://github.com/ross-weir/logex/blob/main/example/src/simple.zig

Hope it's useful for others 🫶

GitHub

logex is a drop-in zig std.log extensions library enabling extra functionality/customization - ross-weir/logex

GitHub

logex is a drop-in zig std.log extensions library enabling extra functionality/customization - ross-weir/logex

median osprey
stuck vortex
#

Do you plan to add a license to the project?

median osprey