Sha256: abcf0a03ca53f8ab1711466c0a298151864c1b6d6583835ec73617663162cb50
Contents?: true
Size: 1.03 KB
Versions: 10
Compression:
Stored size: 1.03 KB
Contents
require 'pathname' require 'semantic_logger' module PactBroker module Logging def self.included(base) base.extend self base.extend SemanticLogger::Loggable::ClassMethods base.class_eval do # Returns [SemanticLogger::Logger] class level logger def self.logger require 'pact_broker/configuration' @logger ||= PactBroker.configuration.custom_logger || SemanticLogger[self] end # Replace instance class level logger def self.logger=(logger) @logger = logger end # Returns [SemanticLogger::Logger] instance level logger def logger @logger ||= self.class.logger end # Replace instance level logger def logger=(logger) @logger = logger end end end def log_error e, description = nil message = "#{e.class} #{e.message} #{e.backtrace.join("\n")}" message = "#{description} - #{message}" if description logger.error message end end include Logging end
Version data entries
10 entries across 10 versions & 1 rubygems