https://github.com/logflare/winston-logflare
https://github.com/logflare/winston-logflare
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/logflare/winston-logflare
- Owner: Logflare
- License: mit
- Created: 2020-05-20T21:44:51.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-08-05T04:08:40.000Z (almost 4 years ago)
- Last Synced: 2025-04-08T19:17:09.982Z (about 1 year ago)
- Language: TypeScript
- Size: 27.3 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# winston-logflare
This module provides a transport for winston logger that forwards messages to [Logflare][logflare] app.
## Installation
```bash
$ npm install winston-logflare
```
# Usage example
```js
const winston = require("winston")
const LogflareTransport = require("winston-logflare")
const apiKey = "..."
const sourceToken = "..."
const logger = winston.createLogger({
level: "info",
format: winston.format.json(),
defaultMeta: {env: "staging"},
transports: [
new LogflareTransport({
apiKey,
sourceToken,
batchMaxSize: 1, // optional config setting
batchFlushInterval: 1000, // optional config setting
}),
],
})
logger.log("info", "info message", {property: "value"})
logger.log("error", "Error occured!")
```
## License
Licensed under [MIT](./LICENSE).
[logflare]: https://logflare.app/