Module: Xlog

Defined in:
lib/xlog.rb,
lib/xlog/version.rb,
lib/xlog/xlogger.rb,
lib/xlog/middleware.rb

Defined Under Namespace

Classes: Config, Middleware, Xlogger

Constant Summary collapse

VERSION =
'0.1.8'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.app_nameObject

Returns the value of attribute app_name.



12
13
14
# File 'lib/xlog.rb', line 12

def app_name
  @app_name
end

.app_rootObject

Returns the value of attribute app_root.



12
13
14
# File 'lib/xlog.rb', line 12

def app_root
  @app_root
end

.base_loggerObject

Returns the value of attribute base_logger.



12
13
14
# File 'lib/xlog.rb', line 12

def base_logger
  @base_logger
end

.configObject

Returns the value of attribute config.



12
13
14
# File 'lib/xlog.rb', line 12

def config
  @config
end

.xloggerObject

Returns the value of attribute xlogger.



12
13
14
# File 'lib/xlog.rb', line 12

def xlogger
  @xlogger
end

Class Method Details

.and_raise_error(e, message: nil, data: nil, tags: []) ⇒ Object



36
37
38
# File 'lib/xlog.rb', line 36

def and_raise_error(e, message: nil, data: nil, tags: [])
  config.xlogger.and_raise_error(e, message, data, tags)
end

.clear_tagsObject

rubocop:enable Layout/LineLength



20
21
22
# File 'lib/xlog.rb', line 20

def clear_tags
  puts "\e[33mWARING: 'clear_tags' is no longer supported as it's not thread safe\e[0m"
end

.configure {|config| ... } ⇒ Object

Yields:



41
42
43
44
# File 'lib/xlog.rb', line 41

def self.configure
  self.config ||= Config.new
  yield(config)
end

.error(e, message: nil, data: nil, tags: []) ⇒ Object



32
33
34
# File 'lib/xlog.rb', line 32

def error(e, message: nil, data: nil, tags: [])
  config.xlogger.error(e, message, data, tags)
end

.info(message, data: nil, tags: []) ⇒ Object



24
25
26
# File 'lib/xlog.rb', line 24

def info(message, data: nil, tags: [])
  config.xlogger.info(message, data, tags)
end

.tag_logger(*_tags) ⇒ Object

rubocop:disable Layout/LineLength



15
16
17
# File 'lib/xlog.rb', line 15

def tag_logger(*_tags)
  puts "\e[33mWARING: 'tag_logger' is no longer supported as it's not thread safe. Use 'tags: ' named argument instead for 'info', 'warn', 'error', 'and_raise_error'.\e[0m"
end

.warn(message, data: nil, tags: []) ⇒ Object



28
29
30
# File 'lib/xlog.rb', line 28

def warn(message, data: nil, tags: [])
  config.xlogger.warn(message, data, tags)
end