Sha256: d60ff503fc57743ef60579f1b97bfa97f728dd00358dfa148d89807fd0821e13
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
# # Copyright 2019- Yuto Suzuki # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require "fluent/plugin/output" require "raven" module Fluent::Plugin class RavenOutput < Output Fluent::Plugin.register_output("raven", self) helpers :inject config_param :dsn, :string, default: nil config_param :environment, :string, default: nil config_param :default_level, :string, :default => 'error' def configure(conf) super if dsn == nil raise Fluent::ConfigError, "Need to Set DSN" end Raven.configure do |config| config.dsn = dsn config.current_environment = environment end end def start super end def write(chunk) tag = chunk.metadata.tag chunk.each do |time, record| Raven.capture_message record['message'], logger: 'fluent-sentry-logger', level: record['level'] || @default_level, tags: { worker: record['worker'], tag: tag } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-raven-0.1.4 | lib/fluent/plugin/out_raven.rb |