All Downloads are FREE. Search and download functionalities are using the official Maven repository.

in.ashwanthkumar.suuchi.utils.Logging.scala Maven / Gradle / Ivy

The newest version!
package in.ashwanthkumar.suuchi.utils

import org.slf4j.LoggerFactory

import scala.util.Try

trait Logging { self =>
  val log = LoggerFactory.getLogger(this.getClass)

  def logOnError[T](f: () => T): Try[T] = {
    Try {
      f()
    } recover {
      case e: Exception =>
        log.error(e.getMessage, e)
        throw e
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy