Package @google-cloud/logging-winston (6.0.0)
Classes
Interfaces
Variables
express.REQUEST_LOG_SUFFIX
REQUEST_LOG_SUFFIX = "_reqlog"
LOGGING_SAMPLED_KEY
LOGGING_SAMPLED_KEY = "logging.googleapis.com/trace_sampled"
LOGGING_SPAN_KEY
LOGGING_SPAN_KEY = "logging.googleapis.com/spanId"
LOGGING_TRACE_KEY
LOGGING_TRACE_KEY = "logging.googleapis.com/trace"
Functions
express.makeMiddleware(logger, transport)
export declare function makeMiddleware(logger: winston.Logger, transport: LoggingWinston): Promise
Parameters |
Name |
Description |
logger |
winston.Logger
|
transport |
LoggingWinston
|
Returns |
Type |
Description |
Promise<Middleware> |
|
express.makeMiddleware(logger, options)
export declare function makeMiddleware(logger: winston.Logger, options?: Options): Promise
Parameters |
Name |
Description |
logger |
winston.Logger
|
options |
Options
|
Returns |
Type |
Description |
Promise<Middleware> |
|
getCurrentTraceFromAgent()
export declare function getCurrentTraceFromAgent(): string | null;
Returns |
Type |
Description |
string | null |
|
export declare function getDefaultMetadataForTracing(): {};
Returns an object that can be passed to Winston.createLogger as defaultMeta to allow log-trace correlation with Winston 3. Log-trace correlation with Winston 3 is broken because the trace ID to be correlated with a log isn't evaluated when the log function is called, but rather when the log is written, which happens at some future point where the trace ID may no longer be accurate. To circumvent this, we take advantage of the fact that defaultMeta is copied when a log function is called, and use a dynamic property getter to evaluate the trace ID upon that copy.
We apply the same principle for timestamps, which is not strictly necessary for tracing but allows for more accurate timestamps in general.
If there are other default metadata fields with which the return value of this function must be merged, this object MUST be the base object. In other words, do not use the return value of this function as the non-first argument to Object.assign, or it will not work.
See https://github.com/googleapis/nodejs-logging-winston/issues/287 for more information.
Returns |
Type |
Description |
{} |
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-10 UTC."],[],[]]