Skip to content

Move abstract logging - #25

Open
blair wants to merge 3 commits into
typesafehub:masterfrom
blair:move-abstract-logging
Open

Move abstract logging#25
blair wants to merge 3 commits into
typesafehub:masterfrom
blair:move-abstract-logging

Conversation

@blair

@blair blair commented Jun 6, 2013

Copy link
Copy Markdown

This branch moves AbstractLogging from com.typesafe.scalalogging.{log4j,slf4j}.AbstractLogging up a level to com.typesafe.scalalogging.AbstractLogging. This allows one to abstract over the logging implementation.

Since AbstractLogging returns a logger, I needed to unify the log4j and sl4fj loggers so added AbstractLogger. Due to restrictions in Scala 2.10 macros, I needed to define the AbstractLogger methods to have the macros work.

blair added 3 commits June 5, 2013 23:35
Use symlinks to have AbstractLogger be identical between the log4j and
the slf4j versions.

Due to macro restrictions, the methods in AbstractLogger have to be
non-abstract otherwise one cannot define a macro:

[error] scalalogging-log4j/src/main/scala/com/typesafe/scalalogging/log4j/Logger.scala:46: overriding method fatal in trait AbstractLogger of type (message: String)Unit;
[error]  macro method fatal cannot override an abstract method
[error]   override def fatal(message: String): Unit = macro LoggerMacros.fatalMessage
[error]                ^
@hseeberger

Copy link
Copy Markdown

@blair, this is cool stuff, yet I think we need to further restructure and refactor the whole project, i.e. this is something for a 2.0 release.

@blair

blair commented Jun 6, 2013

Copy link
Copy Markdown
Author

OK. You could merge in the first commit, the one that adds the 'override'.

@hseeberger

Copy link
Copy Markdown

OK. You could merge in the first commit, the one that adds the 'override'.

Why is it necessary/helpful?

Heiko

@blair

blair commented Jun 6, 2013

Copy link
Copy Markdown
Author

Adding 'override' is good self-documentation. When looking at class in vi or emacs, I like to know if the method is a method in that class or overrides a method from a super-class or super-trait without having to look at the other source files.

http://stackoverflow.com/questions/94361/when-do-you-use-javas-override-annotation-and-why

@hseeberger

Copy link
Copy Markdown

Sure, 100% agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants