Class: Sentry::Breadcrumb

Inherits:
Object
  • Object
show all
Defined in:
lib/sentry/breadcrumb.rb,
lib/sentry/breadcrumb/sentry_logger.rb

Defined Under Namespace

Modules: SentryLogger

Constant Summary collapse

MAX_NESTING =
10
DATA_SERIALIZATION_ERROR_MESSAGE =
"[data were removed due to serialization issues]"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category: nil, data: nil, message: nil, timestamp: nil, level: nil, type: nil) ⇒ Breadcrumb

Returns a new instance of Breadcrumb.

Parameters:

  • category (String, nil) (defaults to: nil)
  • data (Hash, nil) (defaults to: nil)
  • message (String, nil) (defaults to: nil)
  • timestamp (Time, Integer, nil) (defaults to: nil)
  • level (String, nil) (defaults to: nil)
  • type (String, nil) (defaults to: nil)


27
28
29
30
31
32
33
34
# File 'lib/sentry/breadcrumb.rb', line 27

def initialize(category: nil, data: nil, message: nil, timestamp: nil, level: nil, type: nil)
  @category = category
  @data = data || {}
  @timestamp = timestamp || Sentry.utc_now.to_i
  @type = type
  self.message = message
  self.level = level
end

Instance Attribute Details

#categoryString?

Returns:

  • (String, nil)


9
10
11
# File 'lib/sentry/breadcrumb.rb', line 9

def category
  @category
end

#dataHash?

Returns:

  • (Hash, nil)


11
12
13
# File 'lib/sentry/breadcrumb.rb', line 11

def data
  @data
end

#levelString?

Returns:

  • (String, nil)


13
14
15
# File 'lib/sentry/breadcrumb.rb', line 13

def level
  @level
end

#messageString?

Returns:

  • (String, nil)


19
20
21
# File 'lib/sentry/breadcrumb.rb', line 19

def message
  @message
end

#timestampTime, ...

Returns:

  • (Time, Integer, nil)


15
16
17
# File 'lib/sentry/breadcrumb.rb', line 15

def timestamp
  @timestamp
end

#typeString?

Returns:

  • (String, nil)


17
18
19
# File 'lib/sentry/breadcrumb.rb', line 17

def type
  @type
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


37
38
39
40
41
42
43
44
45
46
# File 'lib/sentry/breadcrumb.rb', line 37

def to_hash
  {
    category: @category,
    data: serialized_data,
    level: @level,
    message: @message,
    timestamp: @timestamp,
    type: @type
  }
end