Sha256: 43a80708df689f01650a0a246863c1acafc1cf9b03e59c56d610a2c9b0c77c71
Contents?: true
Size: 631 Bytes
Versions: 1
Compression:
Stored size: 631 Bytes
Contents
require 'speed_gun/store' class SpeedGun::Store::FluentLoggerStore < SpeedGun::Store DEFAULT_PREFIX = 'speed_gun' def initialize(options = {}) @prefix = options[:prefix] || DEFAULT_PREFIX @logger = options[:logger] || default_logger(options) end def save(object) @logger.post(tag(object), object.to_hash.merge(id: object.id)) end def load(klass, id) nil end private def tag(object) object.class.name.sub(/.*::/, '').downcase end def default_logger(options) require 'fluent-logger' unless defined?(Fluent::Logger) Fluent::Logger::FluentLogger.new(@prefix, options) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
speed_gun-1.0.0.rc1 | lib/speed_gun/store/fluent_logger_store.rb |