Skip to content
/ nlog Public

the simplest and most naïve logging library for Scala Native and other worse Scala implementations

Notifications You must be signed in to change notification settings

fiatjaf/nlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nlog

Installation

libraryDependencies += "com.fiatjaf" %%% "nlog" % "0.1.0"

Simple usage

val logger = new nlog.Logger()

val a = 23
var b = false
logger.debug.item("a", a).item(b).msg("something happened")

This will print a somewhat-readable message to STDERR.

Advanced usage

You can define your own printer and log level threshold.

val logger = new nlog.Logger {
  override def print(
    level: nlog.Level,
    items: List[(String, Any) | Any],
    msg: String
  ): Unit = {
    val levelName = level.getClass.getSimpleName.toUpperCase()
    System.err.println(s"[$levelName] | `$msg` | $items")
  }
  override val threshold = nlog.Debug
}

About

the simplest and most naïve logging library for Scala Native and other worse Scala implementations

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages