Coder Social home page Coder Social logo

jokade / slogging Goto Github PK

View Code? Open in Web Editor NEW
49.0 7.0 11.0 116 KB

A Typesafe-logging (and slf4j) compatible logging library based on macros for Scala/JVM, Scala.js, and Scala Native

License: MIT License

Scala 99.69% HTML 0.31%
scala slf4j scala-js log-statements scala-native

slogging's People

Contributors

jokade avatar julienrf avatar lolgab avatar ricogit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

slogging's Issues

Update to Scala 2.13

Please publish artifacts for the latest Scala 2.13.0, it should be rather straightforward to update.

Improve PrintLogger

  • support specification of PrintStream to be used for each level
  • support MessageFormatter

PrintLogger.printTimestamp is missing from 0.6.1

Hello. Im having trouble using PrintLogger in a clean project as it does not have a field printTimestamp for some reason.

My build.sbt:

name := "loggingtest"
version := "0.1"
scalaVersion := "2.12.4"
libraryDependencies += "biz.enef" %% "slogging" % "0.6.1"

Main.scala:

import slogging._

object Main {

  def main(args: Array[String]): Unit = {

    LoggerConfig.factory = PrintLoggerFactory()
    LoggerConfig.level = LogLevel.TRACE

    PrintLogger.printTimestamp = true

  }
}

image

Can you please point me to the right direction? Maybe there is some conflict of versions in maven repository or something?

Sorry for a basic question, I dont really have a lot of experience with Scala environment and I can't figure out what might be the problem.

Extract logging source name from logger instance

Instead of storing the logging source name in the logger instance this should be added as member to the LoggerHolder trait. This way we don't need to generate a logger instance for every LoggingHolder, and we can re-use logger instances in FilterLogger.filter functions.

Provide a FilterLoggerFactory

A FilterLogger uses a PartialFunction that receives the name of the logging source and the LogLevel, and returns the logger instance to be used to log the message.

New release targetting Scala Native 0.4.0-M2

Even if SN 0.4.0-M2 is a milestone, it is quite stable and now used as a target for several projects.
It would thus be great to consider to release a version of slogging compatible with this Scala Native version.

Thanks.

Add TerminalLogger

Provide a TerminalLogger with colored terminal output for scala-native

Change semantics of LoggerFactory.apply()

Currently, calling LoggerFactory.apply() assigns the LoggerFactory on which the call was made to LoggerConfig.factory. We need to remove this side effect in order to be able to build LoggerFactoryS that use other factories (e.g. a FilterLoggerFactory).

New semantics: calling LoggerFactory.apply() simply returns the default instance to be used; factories need to be assigned explicitly, i.e.:

LoggerConfig.factory = PrintLoggerFactory()

Provide a way to set the default logger via configuration or jvm args

The default logger defaults to NullLogger right now. We have backend code that uses slf4j and need a simple way to configure the SLF4JLoggerFactory backend when running in the JVM. This isn't as simple as putting a configuration point in a single place where our application starts. There are numerous other scenarios where we may not go through that entry point but still need our backend code to use the SLF4JLoggerFactory (unit tests, integ tests, console, dev main vs prod main, etc.)

We'd like to configure the slogging backend in a manner similar to what is done to configure Akka to use the slf4j logging backend which is to put an entry in our application.conf like:

slogging.backend = "slogging.SLF4JLoggerFactory"

Unfortunately that would mean that your slogging core would have to take a dependency on TypesafeConfig which probably isn't doable.

An alternative is to allow jvm args: -Dslogging.backend=slogging.SLF4JLoggerFactory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.