Sha256: f3d296bf141b9fbc92b8cfef762b6ecb39904df94c55dacb67435ea1a8dac762

Contents?: true

Size: 678 Bytes

Versions: 14

Compression:

Stored size: 678 Bytes

Contents

# frozen_string_literal: true

SemanticLogger.close
SemanticLogger.default_level = PUNK.get.log.level
if PUNK.get.log.enabled?
  case PUNK.get.log.type
  when :stderr
    SemanticLogger.add_appender(io: $stderr)
  when :stdout
    $stdout.sync = true
    SemanticLogger.add_appender(io: $stdout, formatter: :color)
  when :file
    subdir = PUNK.task.server? ? '.' : PUNK.task
    path = PUNK.get.log.path || File.join(PUNK.get.app.path, '..', 'log', subdir, "#{PUNK.env}.log")
    FileUtils.mkdir_p(File.dirname(path))
    SemanticLogger.add_appender(file_name: path, formatter: :color)
  else
    raise InternalServerError, "Unknown log type :#{PUNK.get.log.type}!"
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
punk-0.3.6 lib/punk/startup/logger.rb
punk-0.3.5 lib/punk/startup/logger.rb
punk-0.3.4 lib/punk/startup/logger.rb
punk-0.3.3 lib/punk/startup/logger.rb
punk-0.3.2 lib/punk/startup/logger.rb
punk-0.3.1 lib/punk/startup/logger.rb
punk-0.2.0 lib/punk/startup/logger.rb
punk-0.1.4 lib/punk/startup/logger.rb
punk-0.1.3 lib/punk/startup/logger.rb
punk-0.1.2 lib/punk/startup/logger.rb
punk-0.1.0 lib/punk/startup/logger.rb
punk-0.0.3 lib/punk/startup/logger.rb
punk-0.0.2 lib/punk/startup/logger.rb
punk-0.0.1 lib/punk/startup/logger.rb