Class: Log4r::OmlOutputter

Inherits:
Outputter
  • Object
show all
Defined in:
lib/oml4r/log4r/oml_outputter.rb

Overview

Log4r outputter which turn logging events into an OML stream

Defined Under Namespace

Classes: LogEventMP

Instance Method Summary collapse

Constructor Details

#initialize(name, opts = {}) ⇒ OmlOutputter

Initialise an outputter which turns logging messages into an OML stream

param name Name of outputter param opts Options for setting up OML opts collect If set to an URL, then initialise OML otherwise assume that someone else is doing it opts domain OML domain to send to (assumes that ‘collect’ is set) [‘log’] opts appName OML domain to send to (assumes that ‘collect’ is set) [fileName-time-pid]



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/oml4r/log4r/oml_outputter.rb', line 42

def initialize(name, opts = {})
  super(name, opts)
  if url = opts['collect']
    h = {}
    opts.each {|k, v| h[k.to_sym] = v}
    opts = h

    opts[:domain] ||= 'log'
    opts[:appName] ||= File.basename(__FILE__, '.*')
    opts[:id] ||= "#{Socket.gethostname}-#{Time.now.iso8601}-#{Process.pid}"
    OML4R.init(nil, opts)
  end
end

Instance Method Details

#closeObject



60
61
62
63
# File 'lib/oml4r/log4r/oml_outputter.rb', line 60

def close
  # OutputterFactory.create_methods(self)
  # Logger.log_internal {"Outputter '#{@name}' closed Syslog and set to OFF"}
end

#closed?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/oml4r/log4r/oml_outputter.rb', line 56

def closed?
  false
end