Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions lib/aws_lambda_ric/logger_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ module LoggerPatch
def initialize(logdev, shift_age = 0, shift_size = 1048576, level: 'debug',
progname: nil, formatter: nil, datetime_format: nil,
binmode: false, shift_period_suffix: '%Y%m%d')
# use unpatched constructor if logdev is a filename or an IO Object other than $stdout or $stderr
if logdev && logdev != $stdout && logdev != $stderr
super(logdev, shift_age, shift_size, level: level, progname: progname,
formatter: formatter, datetime_format: datetime_format,
binmode: binmode, shift_period_suffix: shift_period_suffix)
else
self.level = level
self.progname = progname
logdev_lambda_overwrite = logdev
# use unpatched constructor if logdev is a filename or an IO Object other than $stdout or $stderr
if !logdev || logdev == $stdout || logdev == $stderr
logdev_lambda_overwrite = AwsLambdaRuntimeInterfaceClient::TelemetryLoggingHelper.telemetry_log_sink
@default_formatter = LambdaLogFormatter.new
self.datetime_format = datetime_format
self.formatter = formatter
@logdev = AwsLambdaRuntimeInterfaceClient::TelemetryLoggingHelper.telemetry_log_sink
end

super(logdev_lambda_overwrite, shift_age, shift_size, level: level, progname: progname,
formatter: formatter, datetime_format: datetime_format,
binmode: binmode, shift_period_suffix: shift_period_suffix)
end
end