Module: Jobly::Log

Defined in:
lib/jobly/log.rb

Class Method Summary collapse

Class Method Details

.new(target = nil, tag = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jobly/log.rb', line 7

def new(target = nil, tag = nil)
  if !target || (target.to_sym == :stdout) || (target == $stdout)
    return Logger.new $stdout
  end

  target = target.to_s
  target %= tag if tag && target.include?('%s')

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