Module: Onceover::Logger

Defined in:
lib/onceover/logger.rb

Instance Method Summary collapse

Instance Method Details

#loggerObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/onceover/logger.rb', line 4

def logger
  unless $logger
    # here we setup a color scheme called 'bright'
    Logging.color_scheme(
      'bright',
      :levels => {
        :debug => :cyan,
        :info => :green,
        :warn => :yellow,
        :error => :red,
        :fatal => [:white, :on_red]
      }
    )

    Logging.appenders.stdout(
      'stdout',
      :layout => Logging.layouts.pattern(
        :pattern => '%l\t -> %m\n',
        :color_scheme => 'bright'
      )
    )

    $logger = Logging.logger['Colors']
    $logger.add_appenders 'stdout'
    $logger.level = :info
  end
  $logger
end