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

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)


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

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)


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

def category
  @category
end

#dataHash?

Returns:

  • (Hash, nil)


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

def data
  @data
end

#levelString?

Returns:

  • (String, nil)


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

def level
  @level
end

#messageString?

Returns:

  • (String, nil)


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

def message
  @message
end

#timestampTime, ...

Returns:

  • (Time, Integer, nil)


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

def timestamp
  @timestamp
end

#typeString?

Returns:

  • (String, nil)


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

def type
  @type
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


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

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