Class: Rookout::Logger::LogRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/rookout/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level, message, arguments) ⇒ LogRecord

Returns a new instance of LogRecord.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/rookout/logger.rb', line 61

def initialize level, message, arguments
  @level = level
  @time = Time.new
  @message = message
  @formatted_message = @message % arguments

  arguments.each do |argument|
    if argument.is_a? Exception
      @formatted_message += "\n#{argument.message}\n#{argument.backtrace.join "\n\t"}"
    end
  end

  @arguments = arguments
  set_caller
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



83
84
85
# File 'lib/rookout/logger.rb', line 83

def arguments
  @arguments
end

#filenameObject (readonly)

Returns the value of attribute filename.



79
80
81
# File 'lib/rookout/logger.rb', line 79

def filename
  @filename
end

#formatted_messageObject (readonly)

Returns the value of attribute formatted_message.



82
83
84
# File 'lib/rookout/logger.rb', line 82

def formatted_message
  @formatted_message
end

#levelObject (readonly)

Returns the value of attribute level.



77
78
79
# File 'lib/rookout/logger.rb', line 77

def level
  @level
end

#linenoObject (readonly)

Returns the value of attribute lineno.



80
81
82
# File 'lib/rookout/logger.rb', line 80

def lineno
  @lineno
end

#messageObject (readonly)

Returns the value of attribute message.



81
82
83
# File 'lib/rookout/logger.rb', line 81

def message
  @message
end

#timeObject (readonly)

Returns the value of attribute time.



78
79
80
# File 'lib/rookout/logger.rb', line 78

def time
  @time
end

Instance Method Details

#formatObject



85
86
87
88
# File 'lib/rookout/logger.rb', line 85

def format
  "#{@time} #{Process.pid}:#{Thread.current.name}-" \
    "#{File.basename @filename}:#{@label}@#{lineno} - #{@level} - #{formatted_message}"
end