https://github.com/glebbash/winston-cloudrun
Winston Cloud Run config
https://github.com/glebbash/winston-cloudrun
hacktoberfest logging
Last synced: 8 months ago
JSON representation
Winston Cloud Run config
- Host: GitHub
- URL: https://github.com/glebbash/winston-cloudrun
- Owner: glebbash
- License: mit
- Created: 2021-06-17T10:40:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-28T09:17:57.000Z (about 3 years ago)
- Last Synced: 2024-05-21T01:32:09.291Z (over 1 year ago)
- Topics: hacktoberfest, logging
- Language: TypeScript
- Homepage:
- Size: 510 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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).