Skip to content

Commit

Permalink
Rename #create_log_record to #emit, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylareopelle committed Aug 7, 2023
1 parent f6d01db commit 12d3957
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions logs_api/lib/opentelemetry/logs/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ module Logs
# log appenders/bridges. It should NOT be used directly by application
# developers.
class Logger
# Create a {LogRecord}
# rubocop:disable Style/EmptyMethod

# Emit a {LogRecord} to the processing pipeline.
#
# @param timestamp [optional Float, Time] Time in nanoseconds since Unix
# epoch when the event occurred measured by the origin clock, i.e. the
# time at the source.
# @param observed_timestamp [optional Float, Time] Time in nanoseconds
# since Unix epoch when the event was observed by the collection system.
# Defaults to +Process.clock_gettime(Process::CLOCK_REALTIME)+.
# @param context [optional Context] The Context to associate with the
# LogRecord. Defaults to +OpenTelemetry::Context.current+.
# LogRecord.
# @param severity_number [optional Integer] Numerical value of the
# severity. Smaller numerical values correspond to less severe events
# (such as debug events), larger numerical values correspond to more
Expand All @@ -36,7 +37,7 @@ class Logger
# event.
#
# @api public
def create_log_record(
def emit(
timestamp: nil,
observed_timestamp: Process.clock_gettime(Process::CLOCK_REALTIME),
context: OpenTelemetry::Context.current,
Expand All @@ -45,8 +46,8 @@ def create_log_record(
body: nil,
attributes: nil
)
LogRecord.new
end
# rubocop:enable Style/EmptyMethod
end
end
end
6 changes: 3 additions & 3 deletions logs_api/test/opentelemetry/logs/logger_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
describe OpenTelemetry::Logs::Logger do
let(:logger) { OpenTelemetry::Logs::Logger.new }

describe '#create_log_record' do
it 'creates a new LogRecord' do
assert_instance_of(OpenTelemetry::Logs::LogRecord, logger.create_log_record)
describe '#emit' do
it 'returns nil, as it is a no-op method' do
assert_nil(logger.emit)
end
end
end

0 comments on commit 12d3957

Please sign in to comment.