scribe.modify.LogBooster.scala Maven / Gradle / Ivy
The newest version!
package scribe.modify
import scribe.{LogRecord, Priority}
case class LogBooster(booster: Double => Double,
priority: Priority,
id: String = LogBooster.Id) extends LogModifier {
override def apply(record: LogRecord): Option[LogRecord] = Some(record.boost(booster))
override def withId(id: String): LogModifier = copy(id = id)
}
object LogBooster {
val Id: String = "LogBooster"
def multiply(multiplier: Double, priority: Priority = Priority.Normal): LogBooster = new LogBooster(_ * multiplier, priority)
def add(value: Double, priority: Priority = Priority.Normal): LogBooster = new LogBooster(_ + value, priority)
def subtract(value: Double, priority: Priority = Priority.Normal): LogBooster = new LogBooster(_ - value, priority)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy