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.6'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.app_nameObject

Returns the value of attribute app_name.



10
11
12
# File 'lib/xlog.rb', line 10

def app_name
  @app_name
end

.app_rootObject

Returns the value of attribute app_root.



10
11
12
# File 'lib/xlog.rb', line 10

def app_root
  @app_root
end

.base_loggerObject

Returns the value of attribute base_logger.



10
11
12
# File 'lib/xlog.rb', line 10

def base_logger
  @base_logger
end

.configObject

Returns the value of attribute config.



10
11
12
# File 'lib/xlog.rb', line 10

def config
  @config
end

.xloggerObject

Returns the value of attribute xlogger.



10
11
12
# File 'lib/xlog.rb', line 10

def xlogger
  @xlogger
end

Class Method Details

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



34
35
36
# File 'lib/xlog.rb', line 34

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



18
19
20
# File 'lib/xlog.rb', line 18

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:



39
40
41
42
# File 'lib/xlog.rb', line 39

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

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



30
31
32
# File 'lib/xlog.rb', line 30

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

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



22
23
24
# File 'lib/xlog.rb', line 22

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

.tag_logger(*_tags) ⇒ Object

rubocop:disable Layout/LineLength



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

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



26
27
28
# File 'lib/xlog.rb', line 26

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