Sha256: 5a49e684b06d955baf86dadd1c63ecf999eaa8a556637a9f2e163a50636ee331
Contents?: true
Size: 935 Bytes
Versions: 3
Compression:
Stored size: 935 Bytes
Contents
# frozen_string_literal: true module LogToolbox module LogSimple class << self def log_error(message, additional = {}) log_pattern('error', additional.merge(message: message)) end def log_warn(message, additional = {}) log_pattern('warn', additional.merge(message: message)) end def log_info(message, additional = {}) log_pattern('info', additional.merge(message: message)) end private def log_pattern(level, log_hash) log = default_log(level.upcase).merge(log_hash) puts(normalize_hash(log)) end def default_log(level) { event_at: I18n.l(Time.now, format: :timestamp), level: level, service_name: LogUtil.system_service_name, version: LogUtil.system_version } end def normalize_hash(hash) hash.stringify_keys.to_json end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
log_toolbox-1.3.1 | lib/log_toolbox/log_simple.rb |
log_toolbox-1.3.0 | lib/log_toolbox/log_simple.rb |
log_toolbox-1.2.0 | lib/log_toolbox/log_simple.rb |