Class: Logfoo::Entry

Inherits:
Struct
  • Object
show all
Defined in:
lib/logfoo/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#levelObject

Returns the value of attribute level

Returns:

  • (Object)

    the current value of level



2
3
4
# File 'lib/logfoo/entry.rb', line 2

def level
  @level
end

#logger_nameObject

Returns the value of attribute logger_name

Returns:

  • (Object)

    the current value of logger_name



2
3
4
# File 'lib/logfoo/entry.rb', line 2

def logger_name
  @logger_name
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



2
3
4
# File 'lib/logfoo/entry.rb', line 2

def message
  @message
end

#payloadObject

Returns the value of attribute payload

Returns:

  • (Object)

    the current value of payload



2
3
4
# File 'lib/logfoo/entry.rb', line 2

def payload
  @payload
end

#threadObject

Returns the value of attribute thread

Returns:

  • (Object)

    the current value of thread



2
3
4
# File 'lib/logfoo/entry.rb', line 2

def thread
  @thread
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



2
3
4
# File 'lib/logfoo/entry.rb', line 2

def time
  @time
end

Instance Method Details

#to_hObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/logfoo/entry.rb', line 3

def to_h
  {
    level:   level   || :info,
    time:    time    || Time.now,
    msg:     message,
    logger:  logger_name,
  }.merge!(
    payload || {}
  ).merge!(
    thread:  thread
  )
end