lib/hanami/logger.rb in hanami-utils-1.3.8 vs lib/hanami/logger.rb in hanami-utils-2.0.0.alpha1

- old
+ new

@@ -5,20 +5,20 @@ require "hanami/utils/files" module Hanami # Hanami logger # - # Implementation with the same interface of Ruby std lib `Logger`. + # Implement with the same interface of Ruby std lib `Logger`. # It uses `STDOUT`, `STDERR`, file name or open file as output stream. # # # When a Hanami application is initialized, it creates a logger for that specific application. # For instance for a `Bookshelf::Application` a `Bookshelf::Logger` will be available. # # This is useful for auto-tagging the output. Eg (`app=Booshelf`). # - # When used standalone (eg. `Hanami::Logger.info`), it tags lines with `app=Shared`. + # When used stand alone (eg. `Hanami::Logger.info`), it tags lines with `app=Shared`. # # # The available severity levels are the same of `Logger`: # # * DEBUG @@ -28,11 +28,11 @@ # * FATAL # * UNKNOWN # # Those levels are available both as class and instance methods. # - # Also Hanami::Logger supports different formatters. Now available only two: + # Also Hanami::Logger support different formatters. Now available only two: # # * Formatter (default) # * JSONFormatter # # And if you want to use custom formatter you need create new class inherited from @@ -130,15 +130,15 @@ DEFAULT_APPLICATION_NAME = "hanami" # @since 0.8.0 # @api private LEVELS = ::Hash[ - "debug" => DEBUG, - "info" => INFO, - "warn" => WARN, - "error" => ERROR, - "fatal" => FATAL, + "debug" => DEBUG, + "info" => INFO, + "warn" => WARN, + "error" => ERROR, + "fatal" => FATAL, "unknown" => UNKNOWN ].freeze # @since 1.2.0 # @api private @@ -277,13 +277,13 @@ # # logger = Hanami::Logger.new(formatter: :json) # logger.info "Hello World" # # # => {"app":"Hanami","severity":"DEBUG","time":"2017-03-30T13:57:59Z","message":"Hello World"} - # rubocop:disable Lint/SuppressedException + # rubocop:disable Lint/HandleExceptions # rubocop:disable Metrics/ParameterLists - def initialize(application_name = nil, *args, stream: $stdout, level: DEBUG, formatter: nil, filter: [], colorizer: nil) # rubocop:disable Layout/LineLength + def initialize(application_name = nil, *args, stream: $stdout, level: DEBUG, formatter: nil, filter: [], colorizer: nil) begin Utils::Files.mkdir_p(stream) rescue TypeError end @@ -294,11 +294,11 @@ @application_name = application_name @formatter = Formatter.fabricate(formatter, self.application_name, filter, lookup_colorizer(colorizer)) end # rubocop:enable Metrics/ParameterLists - # rubocop:enable Lint/SuppressedException + # rubocop:enable Lint/HandleExceptions # Returns the current application name, this is used for tagging purposes # # @return [String] the application name # @@ -311,10 +311,10 @@ # @api private def level=(value) super _level(value) end - # Closes the logging stream if this stream isn't an STDOUT + # Close the logging stream if this stream isn't an STDOUT # # @since 0.8.0 def close super unless [STDOUT, $stdout].include?(@stream) end