Sha256: 624f52de105650ccabcc01a18ac440ebb9c43e6748d53d35661cdc3a97f7c8ca

Contents?: true

Size: 939 Bytes

Versions: 1

Compression:

Stored size: 939 Bytes

Contents

require 'logger'

module Filum
  class Logger < ::Logger
    def context_id=(context_id)
      Thread.current[:context_id] = context_id
    end

    def info(str)
      super("#{DateTime.now} thread_id-#{Thread.current.object_id} #{caller[0]} [#{Thread.current[:context_id]}] INFO | #{str}")
    end

    def fatal(str)
      super("#{DateTime.now} thread_id-#{Thread.current.object_id} #{caller[0]} [#{Thread.current[:context_id]}] FATAL | #{str}")
    end

    def error(str)
      super("#{DateTime.now} thread_id-#{Thread.current.object_id} #{caller[0]} [#{Thread.current[:context_id]}] ERROR | #{str}")
    end

    def warn(str)
      super("#{DateTime.now} thread_id-#{Thread.current.object_id} #{caller[0]} [#{Thread.current[:context_id]}] WARN | #{str}")
    end

    def debug(str)
      super("#{DateTime.now} thread_id-#{Thread.current.object_id} #{caller[0]} [#{Thread.current[:context_id]}] DEBUG | #{str}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
filum-0.0.1 lib/filum/logger.rb