1 | /**
|
2 | * Returns an object that can be passed to Winston.createLogger as defaultMeta
|
3 | * to allow log-trace correlation with Winston 3. Log-trace correlation with
|
4 | * Winston 3 is broken because the trace ID to be correlated with a log isn't
|
5 | * evaluated when the log function is called, but rather when the log is
|
6 | * written, which happens at some future point where the trace ID may no longer
|
7 | * be accurate. To circumvent this, we take advantage of the fact that
|
8 | * defaultMeta is copied when a log function is called, and use a dynamic
|
9 | * property getter to evaluate the trace ID upon that copy.
|
10 | *
|
11 | * We apply the same principle for timestamps, which is not strictly necessary
|
12 | * for tracing but allows for more accurate timestamps in general.
|
13 | *
|
14 | * If there are other default metadata fields with which the return value of
|
15 | * this function must be merged, this object MUST be the base object. In other
|
16 | * words, do not use the return value of this function as the non-first argument
|
17 | * to Object.assign, or it will not work.
|
18 | *
|
19 | * See https://github.com/googleapis/nodejs-logging-winston/issues/287 for
|
20 | * more information.
|
21 | */
|
22 | export declare function getDefaultMetadataForTracing(): {};
|