Skip to content

Commit 51e8314

Browse files
authored
Fall back to stderr if the log path contains colons (#3044)
Signed-off-by: Bob Weinand <[email protected]>
1 parent dfce9d8 commit 51e8314

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

Diff for: components-rs/crashtracker.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,16 @@ void ddog_crasht_StackTrace_drop(struct ddog_crasht_Handle_StackTrace *trace);
675675
*/
676676
DDOG_CHECK_RETURN
677677
struct ddog_VoidResult ddog_crasht_StackTrace_push_frame(struct ddog_crasht_Handle_StackTrace *trace,
678-
struct ddog_crasht_Handle_StackFrame *frame);
678+
struct ddog_crasht_Handle_StackFrame *frame,
679+
bool incomplete);
680+
681+
/**
682+
* # Safety
683+
* The `stacktrace` can be null, but if non-null it must point to a StackTrace made by this module,
684+
* which has not previously been dropped.
685+
*/
686+
DDOG_CHECK_RETURN
687+
struct ddog_VoidResult ddog_crasht_StackTrace_set_complete(struct ddog_crasht_Handle_StackTrace *trace);
679688

680689
/**
681690
* Demangles the string "name".

Diff for: components-rs/sidecar.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,16 @@ pub extern "C" fn ddog_sidecar_connect_php(
120120
cfg.log_method = LogMethod::File(str.into());
121121
}
122122
#[cfg(not(windows))]
123-
{ cfg.log_method = LogMethod::File(OsStr::from_bytes(error_path).into()); }
123+
{
124+
// Paths containing a colon generally are some magic - just log to stderr directly
125+
// E.g. "/var/www/html/host:[3]" on a serverless platform
126+
// In general, stdio is the only way for having magic paths here.
127+
if error_path.contains(&b':') {
128+
cfg.log_method = LogMethod::Stderr;
129+
} else {
130+
cfg.log_method = LogMethod::File(OsStr::from_bytes(error_path).into());
131+
}
132+
}
124133
}
125134
#[cfg(windows)]
126135
let log_level = log_level.to_utf8_lossy().as_ref().into();

Diff for: libdatadog

Submodule libdatadog updated 53 files

0 commit comments

Comments
 (0)