1.5.0 • Published 5 months ago

winston-azure-blob v1.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

winston-azure-blob

An Azure Blob transport for winston3

NPM

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 @azure/storage-blob SDK

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

ParameterData TypeDescriptionDefaultType/Options
accountObjectAzure storage account credentials. Can provide either name & key, host & sasToken, or a connectionString.See below
blobNameStringThe name of the blob to log.
bufferLogSizeIntegerA minimum number of logs before syncing the blob.-1
containerNameStringThe container which will contain the logs.
eolStringThe character appended to each log."\n"
extensionStringThe file extension for the log file.No file extension.log via extensions or string file extension
headersArrayColumn headers for csv log files. Headers, when provided, are applied to newly created csv blobs.
levelStringLog level of messages for the transport.info
rotatePeriodString (formatted)A moment format for blob name generation. Ex: YYYY-MM-DD will generate blobName.2000.01.01.""
syncTimeoutInteger (milliseconds)The maximum time between two sync calls. Set to zero for realtime logging.0

Account Credentials Options:

FieldData TypeDescription
nameStringName of the Windows Azure storage account to use.
keyStringAccess key to authenticate into the storage account.
hostStringHTTP address of the storage account.
sasTokenStringShared access signature of the storage account.
connectionStringStringA connection string for the storage account.

Inspo & Credit

https://github.com/sdnetwork/winston3-azureblob-transport

1.5.0

5 months ago

1.4.2

5 months ago

1.4.1

8 months ago

1.4.0

10 months ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago