winston-daily-rotate-file - A transport for winston which logs to a rotating file each day..
A transport for winston which logs to a rotating file each day.
$ sbt clean publish-local
Before running the tests the first time, you must ensure the npm packages are installed:
$ npm install
Then you can run the tests:
$ sbt test
import io.scalajs.nodejs.process
import io.scalajs.npm.winston
import io.scalajs.npm.winston._
import io.scalajs.npm.winston.transports._
import scalajs.js
WinstonDailyRotateFile // 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!")
To add the WinstonDailyRotateFile
binding to your project, add the following to your build.sbt:
libraryDependencies += "io.scalajs.npm" %%% "winston-daily-rotate-file" % "0.5.0"
Optionally, you may add the Sonatype Repository resolver:
resolvers += Resolver.sonatypeRepo("releases")