Logasm

Usage

Creating a new Logasm logger in Ruby

Logasm.build(application_name, logger_config)

application_name is the name of the application. Only logstash logger will use this.

logger_config is a hash with logger types and their configuration.

Configuration

loggers:
  stdout:
    level: 'debug'
  logstash:
    level: 'info'
    host: 'localhost'
    port: 5228

Supported log levels:

  1. fatal
  2. error
  3. warn
  4. info
  5. debug

For example level: 'warn' will log everything with warn and above.

Examples

Creating a new stdout logger

require 'logasm'

logasm = Logasm.build('myApp', stdout: nil)

Creating a new logstash logger

require 'logasm'

logasm = Logasm.build('myApp', logstash: { host: "localhost", port: 5228 })

Creating a new logger that logs into stdout and logstash at the same time

require 'logasm'

logasm = Logasm.build('myApp', { stdout: nil, logstash: { host: "localhost", port: 5228 }})

When no loggers are specified, it creates a stdout logger by default.