Class: GoogleSslCert::Logger

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

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Logger

Returns a new instance of Logger.



5
6
7
8
9
# File 'lib/google_ssl_cert/logger.rb', line 5

def initialize(*args)
  super
  self.formatter = Formatter.new
  self.level = log_level
end

Instance Method Details

#format_message(severity, datetime, progname, msg) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/google_ssl_cert/logger.rb', line 19

def format_message(severity, datetime, progname, msg)
  line = if @logdev.dev == $stdout || @logdev.dev == $stderr
    msg # super simple format if stdout
  else
    super # use the configured formatter
  end
  line =~ /\n$/ ? line : "#{line}\n"
end

#log_levelObject



11
12
13
14
15
16
17
# File 'lib/google_ssl_cert/logger.rb', line 11

def log_level
  if ENV['DEBUG']
    :debug
  else
    ENV['GSC_LOG_LEVEL'] || :info # note: only respected when config.logger not set in config/app.rb
  end
end