Introducing Crylog

Hey, I wanted to take a minute and officially introduce a shard I been working on that is now ready for public usage, although still in its early stages.

Crylog is a flexible logging framework for Crystal based on Monolog. It allows applications to have multiple named loggers, each with various handlers, processors, formatters.

A handler would be something that does something with a logged message. For example logging to a file or STDOUT. But it could also be sending the message to Sentry, or a database etc.

A processor adds extra data to each message. A good use case of this would be adding user/customer ids to each logged message that would represent the user which caused that message to be logged.

Lastly, a formatter of course determines how a message gets serialized. Formatters allow different styles to be used depending on the handler, as HTML would be great for email handlers but not so much for log files.

The core functionality is complete, however there is still work to be done adding handlers/processors/formatters that could benefit all projects. So if anyone wishes to create a PR and “own” a specific piece of functionality I would be grateful, as then each handler is maintained by someone who uses it.

Of course if anyone has any feedback/suggestions, or finds a bug; feel free to get in touch on gitter or make an issue.

11 Likes

My logging system is a puts underneath a rescue. I’m on top of the world.

1 Like

Excellent work, you’re always pushing out really cool stuff, look forward to including this in my projects :slight_smile:

3 Likes

Released a new version that adds a class compatible with the standard library’s ::Logger class. Allows using Crylog with properties/variables typed as ::Logger by mapping a logger of a specific channel to the variable.

Should make it much easier to use in other libraries that have support for ::Logger but not Crylog directly.

1 Like