awesome-logger

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

Awesome Logger

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

⭐️ It aims to be a standard logger in Crystal world. ⭐️

  • 🎀 Cool colorized output
  • 🏆 Customizable handler interface (e.g. Slack notification)
  • 💎 Control log level on code or env var.

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

  • tbrand Taichiro Suzuki - creator, maintainer
Repository

awesome-logger

Owner
Statistic
  • 13
  • 1
  • 1
  • 0
  • 0
  • over 6 years ago
  • July 15, 2018
License

MIT License

Links
Synced at

Mon, 25 Nov 2024 05:01:52 GMT

Languages