GreenLogger

GreenSyslogger logo

Syslogger that makes your life greener

Custom Rails Logger

  • Use Syslog like back storage
  • Posibility to use custom 'facility'
  • Posibility to use custom 'tag'
  • Posibility to use custom 'tag' only in a concrete point so you can configure Syslog to filter this concrete message to another file
  • Compatible with config.logger.auto_flushing = false so every log of a simple request will be written on an atomic way

Install

$ [sudo] gem install green_syslogger

Usage

require 'green_syslogger'
logger = GreenSyslogger.new
logger.debug( 'debug message' )

To install it configure it on the .rb: config.logger = GreenSyslogger.new(, , )

By default GreenSyslogger.new('rails', 'local2', :debug)

Example for Rails configuration:

config.log_level = :info
config.logger = GreenSyslogger.new('myapp', 'local1', config.log_level)
config.colorize_logging = false
config.logger.auto_flushing = false

To use it:

logger.debug("my debug message")
logger.error("my error message")

To user another tag:

logger.custom("my custom message", <tag>, <level>)

By default:

logger.custom("my custom message", 'custom', :info)

TODO

In the GreenSyslogger.custom there are two reopen connections just to be allowed to change the tag, could be better to change the tag without reconnect.

There is not GreenSyslogger.silencer. Maybe is a good idea to implemented.

Change log

v 0.2.0

  • Compatible with config.logger.auto_flushing = false so every log of a simple request will be written on an atomic way

Credits