Skip to content

Commit

Permalink
print datetime to debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
randomanderson committed Jul 18, 2024
1 parent 247c01f commit 5afdc65
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib-injection/host_inject.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
require 'shellwords'
require 'fileutils'
require 'json'
require 'date'

def dd_debug_log(msg)
pid = Process.respond_to?(:pid) ? Process.pid : 0 # Not available on all platforms
$stdout.puts "[datadog][#{pid}][#{$0}] #{msg}" if ENV['DD_TRACE_DEBUG'] == 'true'
$stdout.puts "[datadog][#{DateTime.now}][#{pid}][#{$0}] #{msg}" if ENV['DD_TRACE_DEBUG'] == 'true'
end

def dd_error_log(msg)
pid = Process.respond_to?(:pid) ? Process.pid : 0 # Not available on all platforms
warn "[datadog][#{pid}][#{$0}] #{msg}"
warn "[datadog][#{DateTime.now}][#{pid}][#{$0}] #{msg}"
end

def dd_skip_injection!
Expand Down

0 comments on commit 5afdc65

Please sign in to comment.