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

epic.util.SafeLogging.scala Maven / Gradle / Ivy

There is a newer version: 0.4.4
Show newest version
package epic.util

import com.typesafe.scalalogging.slf4j.Logger
import org.slf4j.LoggerFactory

/**
 * Stupid Typesafe logging lib trait isn't serializable. This is just a better version.
 *
 * @author dlwh
 **/
trait SafeLogging {
  @transient @volatile
  private var _the_logger:Logger = null

  def logger: Logger = {
    var logger = _the_logger
    if(logger eq null) {
      synchronized {
        logger = _the_logger
        if(logger eq null) {
          val ll = Logger(LoggerFactory.getLogger(this.getClass))
          _the_logger = ll
          logger = ll
        }
      }
    }
    logger
  }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy