Sha256: 4271af22815fbf8eb264bb3727d3358f7ba9a2cedff4d46bcdef8fc2b1828004

Contents?: true

Size: 611 Bytes

Versions: 22

Compression:

Stored size: 611 Bytes

Contents

require 'logger'

module Netsoul
  module Logging # :nodoc:
    PREFIX = '[Netsoul-Ruby]'.freeze

    class << self
      attr_writer :logger
    end

    def self.logger
      @logger ||= ::Logger.new(STDERR).tap do |logger|
        logger.level = Logger::INFO
        logger.formatter = proc do |severity, datetime, _progname, msg|
          "#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S.%L'.freeze)}] #{msg}\n"
        end
      end
    end

    private

    def log(level, message)
      Netsoul::Logging.logger.send(level.to_sym, "#{PREFIX} #{message}") if Netsoul::Logging.logger
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
netsoul-2.3.0 lib/netsoul/logging.rb
netsoul-2.2.1 lib/netsoul/logging.rb
netsoul-2.2.0 lib/netsoul/logging.rb
netsoul-2.1.0 lib/netsoul/logging.rb
netsoul-2.0.0 lib/netsoul/logging.rb
netsoul-1.9.3 lib/netsoul/logging.rb
netsoul-1.9.2 lib/netsoul/logging.rb
netsoul-1.9.1 lib/netsoul/logging.rb
netsoul-1.9.0 lib/netsoul/logging.rb
netsoul-1.8.0 lib/netsoul/logging.rb
netsoul-1.7.0 lib/netsoul/logging.rb
netsoul-1.6.0 lib/netsoul/logging.rb
netsoul-1.5.0 lib/netsoul/logging.rb
netsoul-1.4.0 lib/netsoul/logging.rb
netsoul-1.3.0 lib/netsoul/logging.rb
netsoul-1.2.0 lib/netsoul/logging.rb
netsoul-1.1.0 lib/netsoul/logging.rb
netsoul-0.5.0 lib/netsoul/logging.rb
netsoul-0.4.0 lib/netsoul/logging.rb
netsoul-0.3.0 lib/netsoul/logging.rb