Class: ScoutApm::Logger
- Inherits:
-
Object
show all
- Defined in:
- lib/scout_apm/logger.rb
Defined Under Namespace
Classes: DefaultFormatter, TaggedFormatter
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(environment_root, opts = {}) ⇒ Logger
Returns a new instance of Logger.
26
27
28
29
30
31
32
33
34
|
# File 'lib/scout_apm/logger.rb', line 26
def initialize(environment_root, opts={})
@opts = opts
@environment_root = environment_root
@log_destination = determine_log_destination
@logger = build_logger
self.log_level = log_level_from_opts
@logger.formatter = build_formatter
end
|
Instance Attribute Details
#log_destination ⇒ Object
Returns the value of attribute log_destination.
24
25
26
|
# File 'lib/scout_apm/logger.rb', line 24
def log_destination
@log_destination
end
|
Instance Method Details
#debug(*args, &block) ⇒ Object
Delegate calls to the underlying logger
37
|
# File 'lib/scout_apm/logger.rb', line 37
def debug(*args, &block); @logger.debug(*args, &block); end
|
#debug? ⇒ Boolean
43
|
# File 'lib/scout_apm/logger.rb', line 43
def debug?; @logger.debug?; end
|
#error(*args, &block) ⇒ Object
40
|
# File 'lib/scout_apm/logger.rb', line 40
def error(*args, &block); @logger.error(*args, &block); end
|
#error? ⇒ Boolean
46
|
# File 'lib/scout_apm/logger.rb', line 46
def error?; @logger.error?; end
|
#fatal(*args, &block) ⇒ Object
41
|
# File 'lib/scout_apm/logger.rb', line 41
def fatal(*args, &block); @logger.fatal(*args, &block); end
|
#fatal? ⇒ Boolean
47
|
# File 'lib/scout_apm/logger.rb', line 47
def fatal?; @logger.fatal?; end
|
#info(*args, &block) ⇒ Object
38
|
# File 'lib/scout_apm/logger.rb', line 38
def info(*args, &block); @logger.info(*args, &block); end
|
#info? ⇒ Boolean
44
|
# File 'lib/scout_apm/logger.rb', line 44
def info?; @logger.info?; end
|
#log_file_path ⇒ Object
57
58
59
|
# File 'lib/scout_apm/logger.rb', line 57
def log_file_path
@opts.fetch(:log_file_path, "#{@environment_root}/log") || "#{@environment_root}/log"
end
|
#log_level ⇒ Object
53
54
55
|
# File 'lib/scout_apm/logger.rb', line 53
def log_level
@logger.level
end
|
#log_level=(level) ⇒ Object
49
50
51
|
# File 'lib/scout_apm/logger.rb', line 49
def log_level=(level)
@logger.level = log_level_from_opts(level)
end
|
#stderr? ⇒ Boolean
65
66
67
|
# File 'lib/scout_apm/logger.rb', line 65
def stderr?
@opts[:stderr] || (@opts[:log_file_path] || "").upcase == "STDERR"
end
|
#stdout? ⇒ Boolean
61
62
63
|
# File 'lib/scout_apm/logger.rb', line 61
def stdout?
@opts[:stdout] || (@opts[:log_file_path] || "").upcase == "STDOUT"
end
|
#warn(*args, &block) ⇒ Object
39
|
# File 'lib/scout_apm/logger.rb', line 39
def warn(*args, &block); @logger.warn(*args, &block); end
|
#warn? ⇒ Boolean
45
|
# File 'lib/scout_apm/logger.rb', line 45
def warn?; @logger.warn?; end
|