Sha256: 938241f21042e7873d4f4ba1162cf49d1c1509003bd4b859c6e60b48d3ccfefd

Contents?: true

Size: 893 Bytes

Versions: 48

Compression:

Stored size: 893 Bytes

Contents

# encoding: UTF-8
module ForestLiana
  class Logger
    class << self
      def log
        if ForestLiana.logger != nil
          logger = ForestLiana.logger
        else
          logger = ::Logger.new(STDOUT)
          logger_colors = {
            DEBUG: 34,
            WARN: 33,
            ERROR: 31,
            INFO: 37
          }

          logger.formatter = proc do |severity, datetime, progname, message|
            displayed_message = "[#{datetime.to_s(:db)}] Forest 🌳🌳🌳  " \
                  "#{message}\n"
                "\e[#{logger_colors[severity.to_sym]}m#{displayed_message}\033[0m"
          end
          logger
        end
      end
    end
  end

  class Reporter
    def self.report (error)
      ForestLiana.reporter.report error if ForestLiana.reporter
    end
  end
end

FOREST_LOGGER = ForestLiana::Logger.log
FOREST_REPORTER = ForestLiana::Reporter

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
forest_liana-7.8.2 config/initializers/logger.rb
forest_liana-8.0.13 config/initializers/logger.rb
forest_liana-8.0.12 config/initializers/logger.rb
forest_liana-8.0.11 config/initializers/logger.rb
forest_liana-8.0.10 config/initializers/logger.rb
forest_liana-8.0.9 config/initializers/logger.rb
forest_liana-8.0.8 config/initializers/logger.rb
forest_liana-8.0.7 config/initializers/logger.rb
forest_liana-8.0.6 config/initializers/logger.rb
forest_liana-8.0.5 config/initializers/logger.rb
forest_liana-8.0.4 config/initializers/logger.rb
forest_liana-8.0.3 config/initializers/logger.rb
forest_liana-8.0.2 config/initializers/logger.rb
forest_liana-8.0.1 config/initializers/logger.rb
forest_liana-8.0.0 config/initializers/logger.rb
forest_liana-7.8.1 config/initializers/logger.rb
forest_liana-8.0.0.beta.4 config/initializers/logger.rb
forest_liana-8.0.0.beta.3 config/initializers/logger.rb
forest_liana-8.0.0.beta.2 config/initializers/logger.rb
forest_liana-8.0.0.beta.1 config/initializers/logger.rb