https://github.com/scalajs-io/winston-daily-rotate-file
A transport for winston which logs to a rotating file each day.
https://github.com/scalajs-io/winston-daily-rotate-file
node nodejs npm npm-package scala scalajs winston winston-transport
Last synced: 3 months ago
JSON representation
A transport for winston which logs to a rotating file each day.
- Host: GitHub
- URL: https://github.com/scalajs-io/winston-daily-rotate-file
- Owner: scalajs-io
- License: apache-2.0
- Created: 2017-02-14T02:14:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-17T23:11:46.000Z (almost 6 years ago)
- Last Synced: 2025-01-17T22:42:26.745Z (4 months ago)
- Topics: node, nodejs, npm, npm-package, scala, scalajs, winston, winston-transport
- Language: Scala
- Size: 15.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
WinstonDailyRotateFile API for Scala.js
================================
[winston-daily-rotate-file](https://www.npmjs.com/package/winston-daily-rotate-file) - A transport for winston which logs to a rotating file each day..### Description
A transport for [winston](https://github.com/scalajs-io/winston) which logs to a rotating file each day.
### Build Dependencies
* [SBT v1.2.x](http://www.scala-sbt.org/download.html)
### Build/publish the SDK locally
```bash
$ sbt clean publish-local
```### Running the tests
Before running the tests the first time, you must ensure the npm packages are installed:
```bash
$ npm install
```Then you can run the tests:
```bash
$ sbt test
```### Examples
```scala
import io.scalajs.nodejs.process
import io.scalajs.npm.winston
import io.scalajs.npm.winston._
import io.scalajs.npm.winston.transports._
import scalajs.jsWinstonDailyRotateFile // let's ensure the daily rotate file package is loaded
val transport = new winston.transports.DailyRotateFile(new DailyRotateFileOptions(
filename = "./src/test/resources/rotating.log",
datePattern = "yyyy-MM-dd.",
prepend = true,
level = if (process.env.get("ENV").contains("development")) "debug" else "info"
))val logger = new winston.Logger(new ConfigurationOptions(
transports = js.Array(transport)
))logger.info("Hello World!")
```### Artifacts and Resolvers
To add the `WinstonDailyRotateFile` binding to your project, add the following to your build.sbt:
```sbt
libraryDependencies += "io.scalajs.npm" %%% "winston-daily-rotate-file" % "0.5.0"
```Optionally, you may add the Sonatype Repository resolver:
```sbt
resolvers += Resolver.sonatypeRepo("releases")
```