# Package @google-cloud/logging-bunyan (5.1.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [5.1.0 (latest)](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/latest/overview)
- [5.0.1](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/5.0.1/overview)
- [4.2.1](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/4.2.1/overview)
- [4.1.5](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/4.1.5/overview)
- [3.3.0](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/3.3.0/overview)
- [3.2.2](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/3.2.2/overview)
- [3.1.1](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/3.1.1/overview)
- [3.0.2](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/3.0.2/overview)

## Classes

### [LoggingBunyan](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/latest/logging-bunyan/loggingbunyan)

This module provides support for streaming your Bunyan logs to \[Stackdriver Logging\](<https://cloud.google.com/logging>).

## Interfaces

### [express.MiddlewareOptions](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/latest/logging-bunyan/express.middlewareoptions)

### [express.MiddlewareReturnType](https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/latest/logging-bunyan/express.middlewarereturntype)

## Variables

### express.APP_LOG_SUFFIX

    APP_LOG_SUFFIX = "applog"

### LOGGING_SAMPLED_KEY

    LOGGING_SAMPLED_KEY = "logging.googleapis.com/trace_sampled"

Key to use in the Bunyan payload to allow users to indicate a traceSampled flag for the request, and to store as an intermediate value on the log entry before it gets written to the Cloud logging API.

### LOGGING_SPAN_KEY

    LOGGING_SPAN_KEY = "logging.googleapis.com/spanId"

Key to use in the Bunyan payload to allow users to indicate a spanId for the request, and to store as an intermediate value on the log entry before it gets written to the Cloud logging API.

### LOGGING_TRACE_KEY

    LOGGING_TRACE_KEY = "logging.googleapis.com/trace"

Key to use in the Bunyan payload to allow users to indicate a trace for the request, and to store as an intermediate value on the log entry before it gets written to the Cloud Logging logging API.

### NODEJS_BUNYAN_DEFAULT_LIBRARY_VERSION

    NODEJS_BUNYAN_DEFAULT_LIBRARY_VERSION = "5.1.0"

Default library version to be used Using release-please annotations to update DEFAULT_INSTRUMENTATION_VERSION with latest version. See https://github.com/googleapis/release-please/blob/main/docs/customizing.md#updating-arbitrary-files

## Functions

### express.middleware(options)

    export declare function middleware(options?: MiddlewareOptions): Promise

Express middleware

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `options` | `https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/latest/logging-bunyan/express.middlewareoptions` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Promise<https://docs.cloud.google.com/nodejs/docs/reference/logging-bunyan/latest/logging-bunyan/express.middlewarereturntype>` |   |

### getCurrentTraceFromAgent()

    export declare function getCurrentTraceFromAgent(): string | null;

Gets the current fully qualified trace ID when available from the @google-cloud/trace-agent library in the LogEntry.trace field format of: "projects/\[PROJECT-ID\]/traces/\[TRACE-ID\]".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string | null` |   |

## Type Aliases

### express.Logger

    export type Logger = ReturnType