Class: AwsLambdaRuntimeInterfaceClient::TelemetryLoggingHelper
- Inherits:
-
Object
- Object
- AwsLambdaRuntimeInterfaceClient::TelemetryLoggingHelper
- Defined in:
- lib/aws_lambda_ric.rb
Overview
Helper class to for mutating std logger with TelemetryLog
Constant Summary collapse
- ENV_VAR_TELEMETRY_LOG_FD =
'_LAMBDA_TELEMETRY_LOG_FD'
Class Attribute Summary collapse
-
.telemetry_log_fd_file ⇒ Object
Returns the value of attribute telemetry_log_fd_file.
-
.telemetry_log_sink ⇒ Object
Returns the value of attribute telemetry_log_sink.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(telemetry_log_fd, path_to_fd = '/proc/self/fd/') ⇒ TelemetryLoggingHelper
constructor
A new instance of TelemetryLoggingHelper.
Constructor Details
#initialize(telemetry_log_fd, path_to_fd = '/proc/self/fd/') ⇒ TelemetryLoggingHelper
Returns a new instance of TelemetryLoggingHelper.
136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/aws_lambda_ric.rb', line 136 def initialize(telemetry_log_fd, path_to_fd='/proc/self/fd/') fd = "#{path_to_fd}#{telemetry_log_fd}" AwsLambdaRuntimeInterfaceClient::TelemetryLoggingHelper.telemetry_log_fd_file = File.open(fd, 'wb') AwsLambdaRuntimeInterfaceClient::TelemetryLoggingHelper.telemetry_log_fd_file.sync = true AwsLambdaRuntimeInterfaceClient::TelemetryLoggingHelper.telemetry_log_sink = TelemetryLogSink.new(file: AwsLambdaRuntimeInterfaceClient::TelemetryLoggingHelper.telemetry_log_fd_file) mutate_std_logger mutate_kernel_puts rescue Errno::ENOENT # If File.open() fails, then the mutation won't happen and the default behaviour (print to stdout) will prevail end |
Class Attribute Details
.telemetry_log_fd_file ⇒ Object
Returns the value of attribute telemetry_log_fd_file.
129 130 131 |
# File 'lib/aws_lambda_ric.rb', line 129 def telemetry_log_fd_file @telemetry_log_fd_file end |
.telemetry_log_sink ⇒ Object
Returns the value of attribute telemetry_log_sink.
129 130 131 |
# File 'lib/aws_lambda_ric.rb', line 129 def telemetry_log_sink @telemetry_log_sink end |
Class Method Details
.close ⇒ Object
131 132 133 |
# File 'lib/aws_lambda_ric.rb', line 131 def close telemetry_log_fd_file&.close end |