Skip to content

Commit

Permalink
Merge pull request #51 from DataDog/darcy.rayner/set-inject-log-conte…
Browse files Browse the repository at this point in the history
…xt-default

Enable log injection by default
  • Loading branch information
DarcyRaynerDD authored Feb 10, 2020
2 parents 41a8d0b + 67aafe2 commit 291ff1d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ If you set the value of this variable to "true" then the Lambda layer will incre

### DD_LOGS_INJECTION

To connect logs and traces, set the environment variable `DD_LOGS_INJECTION` to `true` if `console` is used for logging. For other logging libraries, see instructions for [automatic](https://docs.datadoghq.com/tracing/advanced/connect_logs_and_traces/?tab=nodejs#automatic-trace-id-injection) and [manual](https://docs.datadoghq.com/tracing/advanced/connect_logs_and_traces/?tab=nodejs#manual-trace-id-injection) trace id injection.
By default, the Datadog trace id gets automatically injected into the logs for correlation, if using `console` or a logging library supported for [automatic](https://docs.datadoghq.com/tracing/connect_logs_and_traces/?tab=nodejs#automatic-trace-id-injection) trace id injection.

See instructions for [manual](https://docs.datadoghq.com/tracing/connect_logs_and_traces/?tab=nodejs#manual-trace-id-injection) trace id injection, if using other logging libraries.

Set the environment variable `DD_LOGS_INJECTION` to `false` to disable this feature.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datadog-lambda-js",
"version": "1.15.0",
"version": "2.16.0",
"description": "Lambda client library that supports hybrid tracing in node js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const defaultConfig: Config = {
autoPatchHTTP: true,
debugLogging: false,
enhancedMetrics: true,
injectLogContext: false,
injectLogContext: true,
logForwarding: false,
mergeDatadogXrayTraces: false,
shouldRetryMetrics: false,
Expand Down Expand Up @@ -153,7 +153,7 @@ function getConfig(userConfig?: Partial<Config>): Config {
}

if (userConfig === undefined || userConfig.injectLogContext === undefined) {
const result = getEnvValue(logInjectionEnvVar, "false").toLowerCase();
const result = getEnvValue(logInjectionEnvVar, "true").toLowerCase();
config.injectLogContext = result === "true";
}

Expand Down

0 comments on commit 291ff1d

Please sign in to comment.