winston-cloudrun
Version:
Winston Cloud Run config
45 lines (31 loc) • 1.17 kB
Markdown
# winston-cloudrun
[](https://github.com/glebbash/winston-cloudrun/actions)
[](https://coveralls.io/github/glebbash/winston-cloudrun?branch=master)
Winston Cloud Run config for logging to stdout in json format with correctly specified `time` and `severity`.
Installation:
```sh
npm i winston-cloudrun
```
Usage:
```ts
import { createLogger } from 'winston';
import { getWinstonCloudRunConfig } from 'winston-cloudrun';
const logger = createLogger(getWinstonCloudRunConfig({
production: true
}));
logger.info('Processing important task...', { data: 'abc' });
/*
{ "severity": "INFO", message: "Processing important task...", data: "abc", time: "2021-06-17T10:39:00.576Z" }
*/
```
Or use only format:
```ts
...
import { getCloudLoggingFormat } from 'winston-cloudrun';
const logger = createLogger({
format: getCloudLoggingFormat(),
...
});
```
Bootstrapped with: [create-ts-lib-gh](https://github.com/glebbash/create-ts-lib-gh)
This project is [Mit Licensed](LICENSE).