# finciero-logger

> Structured Logging Library

Latest version **1.0.0** (published 2016-09-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install finciero-logger
pnpm add finciero-logger
yarn add finciero-logger
bun add finciero-logger
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-09-13 |
| First published | 2016-09-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sebastian Vera |
| Maintainers | sebastianvera |

## Links

- npm: https://www.npmjs.com/package/finciero-logger
- Repository: https://github.com/finciero/node-logger
- Homepage: https://github.com/finciero/node-logger#readme
- Issues: http://github.com/finciero/node-logger/issues
- npm.io page: https://npm.io/package/finciero-logger

## Dependencies (1)

- [winston](https://npm.io/package/winston.md) ^2.2.0

## Recent versions

- 1.0.0 (latest) — 2016-09-13

## README

# Structured Logging

[Winston](https://github.com/winstonjs/winston) wrapper that speaks GCE.

## Usage

Constructor first argument is a persisted default metadata object that gets added to each logging
message, and second arguments specifies the logger level (debug level as default).

The Logger instance has the following methods:
- debug
- info
- warning
- error
- critical

Each method receives a message (string) as first argument, and the second
argument is an optional object that gets merge to the default metadata (specified
when instantiating the logger).

### Examples
```js
const { Logger } = require('finciero-logger')

const logger = new Logger({
  svc_tag: 'foo:1.0.0',
  grpc_address: ':13000',
  http_address: ':8080',
})

logger.info('foo', { custom: 'extra', data: { important: 'value' } })
// output: {"severity":"INFO","message":"foo","meta":{"custom":"extra","data":{"important":"value"},"svc_tag":"foo:1.0.0","grpc_address":":13000","http_address":":8080"}}
```

```js
const { Logger } = require('finciero-logger')

const level = 'info' // 'debug', 'info', 'warning', 'error' and 'critical' are valid level values
const logger = new Logger({
  svc_tag: 'foo:1.0.0',
  grpc_address: ':13000',
  http_address: ':8080',
}, level) 
logger.info('foo', { custom: 'extra', data: { important: 'value' } })
// output: {"severity":"INFO","message":"foo","meta":{"custom":"extra","data":{"important":"value"},"svc_tag":"foo:1.0.0","grpc_address":":13000","http_address":":8080"}}
```

---------

Most of the code was borrowed from https://github.com/dannydavidson/winston-gke

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