Class: Dk::Config::LogslyLogger

Inherits:
Object
  • Object
show all
Includes:
Logsly
Defined in:
lib/dk/config.rb

Constant Summary collapse

LOG_TYPE =
'dk'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ LogslyLogger

Returns a new instance of LogslyLogger.



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/dk/config.rb', line 192

def initialize(config)
  @config = config # set the reader first so it can be used when supering

  Logsly.stdout(@config.dk_logger_stdout_output_name) do |logger|
    level   logger.config.stdout_log_level
    pattern logger.config.log_pattern
  end
  outputs = [@config.dk_logger_stdout_output_name]

  if @config.log_file
    Logsly.file(@config.dk_logger_file_output_name) do |logger|
      path    File.expand_path(logger.config.log_file, ENV['PWD'])
      level   Dk::Config::FILE_LOG_LEVEL
      pattern logger.config.log_file_pattern
    end
    outputs << @config.dk_logger_file_output_name
  end

  super(LOG_TYPE, :outputs => outputs)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



190
191
192
# File 'lib/dk/config.rb', line 190

def config
  @config
end