Class: Syntropy::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/syntropy/logger.rb

Overview

The Logger class implements a logger with support for structured logging.

Instance Method Summary collapse

Constructor Details

#initialize(machine, fd = $stdout.fileno, **opts) ⇒ void

Initializes the logger.

Parameters:

  • machine (UringMachine)

    machine instance

  • fd (Integer) (defaults to: $stdout.fileno)

    file descriptor for writing log messages

  • opts (Hash)

    logger options



14
15
16
17
18
# File 'lib/syntropy/logger.rb', line 14

def initialize(machine, fd = $stdout.fileno, **opts)
  @machine = machine
  @fd = fd
  @opts = opts
end

Instance Method Details

#error(o) ⇒ void

This method returns an undefined value.

Logs an ERROR entry.

Parameters:

  • o (Hash)

    log entry



40
41
42
# File 'lib/syntropy/logger.rb', line 40

def error(o)
  call(:ERROR, o)
end

#info(o) ⇒ void

This method returns an undefined value.

Logs an INFO entry.

Parameters:

  • o (Hash)

    log entry



24
25
26
# File 'lib/syntropy/logger.rb', line 24

def info(o)
  call(:INFO, o)
end

#warn(o) ⇒ void

This method returns an undefined value.

Logs an WARN entry.

Parameters:

  • o (Hash)

    log entry



32
33
34
# File 'lib/syntropy/logger.rb', line 32

def warn(o)
  call(:WARN, o)
end