winston-azure-blob
winston-azure-blobAn Azure Blob transport for winston3

Highlights
- :heavy_check_mark: Simple API
- Easy to use API with sensible defaults
- :large_blue_circle: Typescript ready
- :closed_lock_with_key: SAS support
- Use a Shared Access Signature or key/name auth
- :wrench: Highly configurable
- Lots of options for customization in specific use cases
- :cloud: Modern
- Uses the new
SDK@azure/storage-blob
- Uses the new
Installation
yarn install winston yarn install winston-azure-blob
Usage
import * as winston from "winston"; import { winstonAzureBlob, extensions } from "winston-azure-blob"; const logger = winston.createLogger({ format: winston.format.combine( winston.format.timestamp(), winston.format.splat(), winston.format.json() ), transports: [ winstonAzureBlob({ account: { name: "Azure storage account sub domain ([A-Za-z0-9])", key: "The long Azure storage secret key" // or host: 'The host address', sasToken: 'The Shared Access Signature token' // or connectionString: 'A connection string for the storage account' }, blobName: "The name of the blob", bufferLogSize : 1, containerName: "A container name", eol : "\n", extension : extensions.LOG, level: "info", rotatePeriod : "YYYY-MM-DD", syncTimeout : 0, }) ] }); logger.warn("Hello!");
API
| Parameter | Data Type | Description | Default | Type/Options |
|---|---|---|---|---|
| Object | Azure storage account credentials. Can provide either & , & , or a . | See below | |
| String | The name of the blob to log. | ||
| Integer | A minimum number of logs before syncing the blob. | -1 | |
| String | The container which will contain the logs. | ||
| String | The character appended to each log. | "\n" | |
| String | The file extension for the log file. | No file extension | via or string file extension |
| Array | Column headers for csv log files. Headers, when provided, are applied to newly created csv blobs. | ||
| String | Log level of messages for the transport. | | |
| String (formatted) | A moment format for blob name generation. Ex: will generate . | "" | |
| Integer (milliseconds) | The maximum time between two sync calls. Set to zero for realtime logging. | 0 |
Account Credentials Options:
| Field | Data Type | Description |
|---|---|---|
| String | Name of the Windows Azure storage account to use. |
| String | Access key to authenticate into the storage account. |
| String | HTTP address of the storage account. |
| String | Shared access signature of the storage account. |
| String | A connection string for the storage account. |