Skip to content

Move abstract logging #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

blair
Copy link

@blair blair commented Jun 6, 2013

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
Contributor

@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
Copy link
Author

blair commented Jun 6, 2013

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

@hseeberger
Copy link
Contributor

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

Why is it necessary/helpful?

Heiko

@blair
Copy link
Author

blair commented Jun 6, 2013

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
Contributor

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