20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/ree_lib/packages/ree_logger/package/ree_logger/beans/logger.rb', line 20
def build
appenders = []
if config.levels.file
if is_blank(config.file_path)
raise ArgumentError, "use ENV['LOG_FILE_PATH'] to specify path to log file"
end
appenders << FileAppender.new(
config.levels.file, nil, config.file_path, auto_flush: config.file_auto_flush
)
end
if config.levels.stdout
appenders << StdoutAppender.new(
config.levels.stdout, nil
)
end
if config.rollbar.enabled
opts = {}
opts[:branch] = config.rollbar.branch if config.rollbar.branch
opts[:host] = config.rollbar.host if config.rollbar.host
appenders << RollbarAppender.new(
config.levels.rollbar,
access_token: config.rollbar.access_token,
environment: config.rollbar.environment,
**opts
)
end
build_logger(
appenders,
ENV['APP_NAME'],
RateLimiter.new(
config.rate_limit.interval,
config.rate_limit.max_count
),
config.default_filter_words
)
end
|