# azure-table-logger

> A logger using pino or winston that appending to Azure Data Table automatically

Latest version **1.0.8** (published 2022-09-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install azure-table-logger
pnpm add azure-table-logger
yarn add azure-table-logger
bun add azure-table-logger
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2022-09-27 |
| First published | 2022-08-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 16.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Leon Shih |
| Maintainers | leonshih |
| Keywords | azure, pino, winston, logger |

## Links

- npm: https://www.npmjs.com/package/azure-table-logger
- Repository: https://github.com/leonshih/azure-table-logger
- Homepage: https://github.com/leonshih/azure-table-logger#readme
- Issues: https://github.com/leonshih/azure-table-logger/issues
- npm.io page: https://npm.io/package/azure-table-logger

## Dependencies (15)

- [os](https://npm.io/package/os.md) ^0.1.2
- [path](https://npm.io/package/path.md) ^0.12.7
- [pino](https://npm.io/package/pino.md) ^8.3.1
- [pump](https://npm.io/package/pump.md) ^3.0.0
- [dotenv](https://npm.io/package/dotenv.md) ^16.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [split2](https://npm.io/package/split2.md) ^4.1.0
- [winston](https://npm.io/package/winston.md) ^3.8.1
- [through2](https://npm.io/package/through2.md) ^4.0.2
- [pino-pretty](https://npm.io/package/pino-pretty.md) ^9.1.0
- [@types/lodash](https://npm.io/package/@types/lodash.md) ^4.14.182
- [fast-json-parse](https://npm.io/package/fast-json-parse.md) ^1.0.3
- [pino-multi-stream](https://npm.io/package/pino-multi-stream.md) ^6.0.0
- [winston-transport](https://npm.io/package/winston-transport.md) ^4.5.0
- [@azure/data-tables](https://npm.io/package/@azure/data-tables.md) ^13.1.2

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.8 (latest) — 2022-09-27
- 1.0.7 — 2022-09-27
- 1.0.6 — 2022-09-21
- 1.0.5 — 2022-09-21
- 1.0.4 — 2022-09-13
- 1.0.3 — 2022-09-08
- 1.0.2 — 2022-08-25
- 1.0.1 — 2022-08-25
- 1.0.0 — 2022-08-25

## README

# azure-table-logger
[![npm version](https://img.shields.io/npm/v/azure-table-logger)](https://www.npmjs.com/package/azure-table-logger)

## Install

```
npm install azure-table-logger
```

or use yarn

```
yarn add azure-table-logger
```

## Usage

```js
import { createAzureDataTable, createLogger } from 'azure-table-logger';

if(process.env.LOG_TO_AZURE_TABLE === 'true')
	await createAzureDataTable();

const logger = createLogger(__filename);

logger.info('info message');
logger.error(new Error('test error'));
```

It will present:
```js
[2022-08-02 03:20:51.552 +0000] INFO (app.ts): info message
[2022-08-02 03:20:51.555 +0000] ERROR (app.ts): test error
    err: {
      "type": "Error",
      "message": "test error",
      "stack":
          Error: test error
              at .../lib/app.ts:22:16
              at processTicksAndRejections (node:internal/process/task_queues:96:5)
    }
```

## .env

```
LOGGER = pino
LOG_LEVEL = info
LOG_TO_AZURE_TABLE = true
AZURE_STORAGE_ACCOUNT = YOUR_AZURE_STORAGE_ACCOUNT
AZURE_STORAGE_ACCOUNT_KEY = YOUR_AZURE_STORAGE_ACCOUNT_KEY
```
- LOGGER
    - pino (recommended)
    - winston
- LOG_LEVEL
    - pino levels: trace | debug | info | warn | error | fatal | silent
    - winston levels: error | warn | info | http | verbose | debug | silly
- LOG_TO_AZURE_TABLE: true | false

---
_Source: https://npm.io/package/azure-table-logger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
