getTransport() function

Constructs a winston transport of the named type.

Signature:

export declare function getTransport(type: string, options: FileTransportOptions | HttpTransportOptions): Transport;

Parameters

Parameter

Type

Description

type

string

'file' or 'http'

options

FileTransportOptions | HttpTransportOptions

options for the winston transport constructor

Returns:

Transport

the transport, or nothing if the type is not recognised

Remarks

Only 'file' and 'http' are supported. Anything else returns nothing — despite the declared return type, which is a Transport cast rather than a guarantee. Logger checks for that and reports the offending type; a direct caller must check too.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.