Awesome Logger

Awesome Logger is SIMPLE and FLEXIBLE logger for Crystal applications.**

:star: It aims to be a standard logger in Crystal world. :star:

Installation

Add this to your application's shard.yml:

dependencies:
  awesome-logger:
    github: tbrand/awesome-logger

Usage

require "awesome-logger"

See example/ for basic usages.

Logger.debug("this is a debug message")
# Logger.d("your message") for short

Control log level

You can set log level by

# The level is one of :debug, :info, :warning, :error or :fatal
Logger.set_level(:debug)

You can override the level by set env var of CR_LOG_LEVEL.

# The level is one of DEBUG, INFO, WARNING, ERROR or FATAL
> export CR_LOG_LEVEL=DEBUG

The default log level is :info.

Custom handler

You can define your custom handler for the logger.

This is useful when you want to hook some logs. (e.g. error notification)

For the slack notification, the example code is at example/slack_notification.cr.

Contributing

  1. Fork it (https://github.com/tbrand/awesome-logger/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors