module Jobly::Log

Public Class Methods

new(target = nil, tag = nil) click to toggle source
# File lib/jobly/log.rb, line 6
def self.new(target = nil, tag = nil)
  if !target or target.to_sym == :stdout or target == STDOUT
    return Logger.new STDOUT
  end

  target = target.to_s
  target %= tag if tag and target.include? "%s"

  if target.start_with? 'syslog://'
    remote_syslog_logger target
  else
    Logger.new File.expand_path(target, Jobly.root)
  end
end

Private Class Methods

remote_syslog_logger(target) click to toggle source
# File lib/jobly/log.rb, line 23
def self.remote_syslog_logger(target)
  uri = URI target
  RemoteSyslogLogger.new (uri.host || 'localhost'), (uri.port || 514), 
    local_hostname: uri.user, program: uri.password
end