Class: Fluent::Plugin::RavenOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_raven.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object

Raises:

  • (Fluent::ConfigError)


32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fluent/plugin/out_raven.rb', line 32

def configure(conf)
  super

  raise Fluent::ConfigError, 'Need to Set DSN' if dsn.nil?

  Sentry.init do |config|
    config.logger.level = logger_level
    config.dsn = dsn
    config.environment = environment
  end
end

#startObject



44
45
46
# File 'lib/fluent/plugin/out_raven.rb', line 44

def start
  super
end

#write(chunk) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fluent/plugin/out_raven.rb', line 48

def write(chunk)
  tag = chunk..tag
  chunk.each do |_time, record|
    Sentry.capture_message record['message'],
                           level: record['level'] || @default_level,
                           tags: {
                             logger: 'fluent-sentry-logger',
                             worker: record['worker'],
                             tag: tag
                           }
  end
end