Skip to content

Instantly share code, notes, and snippets.

@taylorleese
Created November 17, 2011 07:54
Show Gist options
  • Save taylorleese/1372639 to your computer and use it in GitHub Desktop.
Save taylorleese/1372639 to your computer and use it in GitHub Desktop.
Cleaner Logging
package sugar
import org.slf4j.{Logger, LoggerFactory}
trait LoggingSugar {
/**
* This is just a convenience method so you can type:
*
* getLogger[Foo]
*
* ...rather than...
*
* LoggerFactory.getLogger(classOf[Foo])
*
*/
def getLogger[T <: AnyRef](implicit manifest: Manifest[T]): Logger = {
LoggerFactory.getLogger(manifest.erasure.asInstanceOf[Class[T]])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment