[slf4j-dev] [GIT] SLF4J: Simple Logging Facade for Java branch, master, updated. v_1.6.1-5-g277f8d7

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Tue Sep 14 22:19:44 CEST 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".

The branch, master has been updated
       via  277f8d74ce14805067943bcdc093f39e80a6c34e (commit)
       via  adab6086edd259882f90fcbe0d565fbd038d092b (commit)
      from  f31b487e0c856acf348b0c08a80b33326a98ca64 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=277f8d74ce14805067943bcdc093f39e80a6c34e
http://github.com/ceki/slf4j/commit/277f8d74ce14805067943bcdc093f39e80a6c34e

commit 277f8d74ce14805067943bcdc093f39e80a6c34e
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Tue Sep 14 22:18:24 2010 +0200

    - started working on slf4j 1.6.2-SNAPSHOT
    - Small additions to .gitignore file

diff --git a/.gitignore b/.gitignore
index a34f981..3d3547c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,8 @@ target
 .project
 *~
 *.tmproj
+*.iml
+.idea
 .scala_dependencies
 integration/bundle/
 integration/felix-cache/
diff --git a/integration/pom.xml b/integration/pom.xml
index fa9f14e..2c6d90e 100644
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>org.slf4j</groupId>
 		<artifactId>slf4j-parent</artifactId>
-    	<version>1.6.1</version>
+    	<version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/jcl-over-slf4j/pom.xml b/jcl-over-slf4j/pom.xml
index cec9873..7ea5b92 100644
--- a/jcl-over-slf4j/pom.xml
+++ b/jcl-over-slf4j/pom.xml
@@ -3,7 +3,7 @@
 	<parent>
 		<groupId>org.slf4j</groupId>
 		<artifactId>slf4j-parent</artifactId>
-    <version>1.6.1</version>
+    <version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/jul-to-slf4j/pom.xml b/jul-to-slf4j/pom.xml
index cd8d598..2e65a19 100644
--- a/jul-to-slf4j/pom.xml
+++ b/jul-to-slf4j/pom.xml
@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>org.slf4j</groupId>
 		<artifactId>slf4j-parent</artifactId>
-    	<version>1.6.1</version>
+    	<version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/log4j-over-slf4j/pom.xml b/log4j-over-slf4j/pom.xml
index 434199b..c6cd51a 100644
--- a/log4j-over-slf4j/pom.xml
+++ b/log4j-over-slf4j/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-parent</artifactId>
-    <version>1.6.1</version>
+    <version>1.6.2-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/osgi-over-slf4j/pom.xml b/osgi-over-slf4j/pom.xml
index 6a18c58..7aef9b3 100644
--- a/osgi-over-slf4j/pom.xml
+++ b/osgi-over-slf4j/pom.xml
@@ -3,7 +3,7 @@
   <parent>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-parent</artifactId>
-    <version>1.6.1</version>
+    <version>1.6.2-SNAPSHOT</version>
   </parent>
   
   <modelVersion>4.0.0</modelVersion>
diff --git a/pom.xml b/pom.xml
index 13da385..5f688b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
 
 	<groupId>org.slf4j</groupId>
 	<artifactId>slf4j-parent</artifactId>
-	<version>1.6.1</version>
+	<version>1.6.2-SNAPSHOT</version>
 
 	<packaging>pom</packaging>
 	<name>SLF4J</name>
diff --git a/slf4j-api/pom.xml b/slf4j-api/pom.xml
index e4e9b65..4e3be80 100644
--- a/slf4j-api/pom.xml
+++ b/slf4j-api/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-parent</artifactId>
-    <version>1.6.1</version>
+    <version>1.6.2-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-ext/pom.xml b/slf4j-ext/pom.xml
index 1e31a77..e98564a 100644
--- a/slf4j-ext/pom.xml
+++ b/slf4j-ext/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-parent</artifactId>
-    <version>1.6.1</version>
+    <version>1.6.2-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-jcl/pom.xml b/slf4j-jcl/pom.xml
index fdfbc8f..dd97198 100644
--- a/slf4j-jcl/pom.xml
+++ b/slf4j-jcl/pom.xml
@@ -3,7 +3,7 @@
 	<parent>
 		<groupId>org.slf4j</groupId>
 		<artifactId>slf4j-parent</artifactId>
-		<version>1.6.1</version>
+		<version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-jdk14/pom.xml b/slf4j-jdk14/pom.xml
index 2e4a3f4..2dd6feb 100644
--- a/slf4j-jdk14/pom.xml
+++ b/slf4j-jdk14/pom.xml
@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>org.slf4j</groupId>
 		<artifactId>slf4j-parent</artifactId>
-    	<version>1.6.1</version>
+    	<version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-log4j12/pom.xml b/slf4j-log4j12/pom.xml
index 6953e5c..7ff0a4a 100644
--- a/slf4j-log4j12/pom.xml
+++ b/slf4j-log4j12/pom.xml
@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>org.slf4j</groupId>
 		<artifactId>slf4j-parent</artifactId>
-        <version>1.6.1</version>
+        <version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-migrator/pom.xml b/slf4j-migrator/pom.xml
index 31237d7..1464540 100644
--- a/slf4j-migrator/pom.xml
+++ b/slf4j-migrator/pom.xml
@@ -7,7 +7,7 @@
 	<parent>
 	  <groupId>org.slf4j</groupId>
       <artifactId>slf4j-parent</artifactId>
-      <version>1.6.1</version>
+      <version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-nop/pom.xml b/slf4j-nop/pom.xml
index 1eaf1b1..d355461 100644
--- a/slf4j-nop/pom.xml
+++ b/slf4j-nop/pom.xml
@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>org.slf4j</groupId>
 		<artifactId>slf4j-parent</artifactId>
-    	<version>1.6.1</version>
+    	<version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-osgi-integration-test/pom.xml b/slf4j-osgi-integration-test/pom.xml
index 4f9c606..e0b3dfa 100644
--- a/slf4j-osgi-integration-test/pom.xml
+++ b/slf4j-osgi-integration-test/pom.xml
@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>org.slf4j</groupId>
 		<artifactId>slf4j-parent</artifactId>
-		<version>1.6.1</version>
+		<version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-osgi-test-bundle/pom.xml b/slf4j-osgi-test-bundle/pom.xml
index fe85a98..9567457 100644
--- a/slf4j-osgi-test-bundle/pom.xml
+++ b/slf4j-osgi-test-bundle/pom.xml
@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>org.slf4j</groupId>
 		<artifactId>slf4j-parent</artifactId>
-		<version>1.6.1</version>
+		<version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-scala-api/pom.xml b/slf4j-scala-api/pom.xml
index c77a33c..63e07d3 100644
--- a/slf4j-scala-api/pom.xml
+++ b/slf4j-scala-api/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-parent</artifactId>
-    <version>1.6.1</version>
+    <version>1.6.2-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-simple/pom.xml b/slf4j-simple/pom.xml
index 3275f44..ab6f41c 100644
--- a/slf4j-simple/pom.xml
+++ b/slf4j-simple/pom.xml
@@ -3,7 +3,7 @@
   <parent>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-parent</artifactId>
-    <version>1.6.1</version>
+    <version>1.6.2-SNAPSHOT</version>
   </parent>
 	
 	<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-site/pom.xml b/slf4j-site/pom.xml
index fb1b2f7..420cca8 100644
--- a/slf4j-site/pom.xml
+++ b/slf4j-site/pom.xml
@@ -5,7 +5,7 @@
 	<parent>
 		<groupId>org.slf4j</groupId>
 		<artifactId>slf4j-parent</artifactId>
-    <version>1.6.1</version>
+    <version>1.6.2-SNAPSHOT</version>
 	</parent>
 	
 	<modelVersion>4.0.0</modelVersion>

http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=adab6086edd259882f90fcbe0d565fbd038d092b
http://github.com/ceki/slf4j/commit/adab6086edd259882f90fcbe0d565fbd038d092b

commit adab6086edd259882f90fcbe0d565fbd038d092b
Author: Heiko Seeberger <heiko.seeberger at googlemail.com>
Date:   Tue Sep 14 21:43:34 2010 +0200

    Initial contribution from SLF4S: Release 1.0.1 without stupid implicit conversion. OSGi stuff still missing!

diff --git a/.gitignore b/.gitignore
index f69eeb6..a34f981 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,5 +3,7 @@ target
 .classpath
 .project
 *~
+*.tmproj
+.scala_dependencies
 integration/bundle/
-integration/felix-cache/
\ No newline at end of file
+integration/felix-cache/
diff --git a/pom.xml b/pom.xml
index 3ec46bd..13da385 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,6 +35,7 @@
 
 	<modules>
 		<module>slf4j-api</module>
+		<module>slf4j-scala-api</module>
     <module>slf4j-simple</module>  
     <module>slf4j-nop</module>
 		<module>slf4j-jdk14</module>
@@ -349,4 +350,4 @@
 
 	</distributionManagement>
   
-</project>
\ No newline at end of file
+</project>
diff --git a/slf4j-scala-api/pom.xml b/slf4j-scala-api/pom.xml
new file mode 100644
index 0000000..c77a33c
--- /dev/null
+++ b/slf4j-scala-api/pom.xml
@@ -0,0 +1,175 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <groupId>org.slf4j</groupId>
+    <artifactId>slf4j-parent</artifactId>
+    <version>1.6.1</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.slf4j</groupId>
+  <artifactId>slf4j-scala-api</artifactId>
+  <packaging>jar</packaging><!-- TODO: Switch to bundle! -->
+  <name>SLF4J Scala API Module</name>
+
+  <url>http://www.slf4j.org</url>
+  <description>The slf4j Scala API</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <scala.version>2.8.0</scala.version>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.scala-lang</groupId>
+      <artifactId>scala-library</artifactId>
+      <version>${scala.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.scala-tools.testing</groupId>
+      <artifactId>specs_2.8.0</artifactId>
+      <version>1.6.5</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <version>1.8.4</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.7</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies> 
+
+  <build>
+    <plugins>
+
+      <plugin>
+        <groupId>org.scala-tools</groupId>
+        <artifactId>maven-scala-plugin</artifactId>
+        <version>2.14.1</version>
+        <configuration>
+          <scalaVersion>${scala.version}</scalaVersion>
+          <charset>${project.build.sourceEncoding}</charset>
+          <jvmArgs>
+            <jvmArg>-Xmx1024m</jvmArg>
+          </jvmArgs>
+          <args>
+            <arg>-make:changed</arg>
+            <arg>-deprecation</arg>
+            <arg>-unchecked</arg>
+          </args>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>compile</goal>
+              <goal>testCompile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.4.3</version>
+        <configuration>
+          <includes>
+            <include>**/*Spec.java</include>
+            <include>**/*Test.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+      <!--plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>once</forkMode>
+          <reportFormat>plain</reportFormat>
+          <trimStackTrace>false</trimStackTrace>
+          <excludes>
+            <exclude>**/AllTest.java</exclude>
+            <exclude>**/PackageTest.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin-->
+
+      <!--plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestEntries>
+              <Bundle-Version>${parsedVersion.osgiVersion}</Bundle-Version>
+              <Bundle-Description>${project.description}</Bundle-Description>
+              <Implementation-Version>${project.version}</Implementation-Version>
+            </manifestEntries>
+            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+          </archive>
+        </configuration>
+        <executions>
+          <execution>
+            <id>bundle-test-jar</id>
+            <phase>package</phase>
+            <goals>
+              <goal>jar</goal>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin-->
+
+      <!--plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>process-classes</phase>
+            <goals>
+             <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <tasks>
+            <echo>Removing slf4j-api's dummy StaticLoggerBinder and StaticMarkerBinder</echo>
+            <delete dir="target/classes/org/slf4j/impl"/>
+          </tasks>
+        </configuration>
+      </plugin-->
+
+    </plugins>
+
+  </build>
+  
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>clirr-maven-plugin</artifactId>
+        <configuration>
+          <comparisonVersion>1.5.6</comparisonVersion>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
+
+</project>
\ No newline at end of file
diff --git a/slf4j-scala-api/src/main/scala/Logging.scala b/slf4j-scala-api/src/main/scala/Logging.scala
new file mode 100644
index 0000000..a67c717
--- /dev/null
+++ b/slf4j-scala-api/src/main/scala/Logging.scala
@@ -0,0 +1,37 @@
+/* 
+ * Copyright (c) 2010 Weigle Wilczek GmbH
+ * All rights reserved.
+ * 
+ * Permission is hereby granted, free  of charge, to any person obtaining
+ * a  copy  of this  software  and  associated  documentation files  (the
+ * "Software"), to  deal in  the Software without  restriction, including
+ * without limitation  the rights to  use, copy, modify,  merge, publish,
+ * distribute,  sublicense, and/or sell  copies of  the Software,  and to
+ * permit persons to whom the Software  is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The  above  copyright  notice  and  this permission  notice  shall  be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+ * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+ * MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+package org.slf4j.scala
+
+import org.slf4j.LoggerFactory
+
+/**
+ * Mixin providing a Logger for the type mixed into.
+ */
+trait Logging {
+
+  /**
+   * Logger for the type mixed into.
+   */
+  protected[scala] lazy val logger = Logger(this.getClass)
+}
diff --git a/slf4j-scala-api/src/main/scala/logger.scala b/slf4j-scala-api/src/main/scala/logger.scala
new file mode 100644
index 0000000..1503e95
--- /dev/null
+++ b/slf4j-scala-api/src/main/scala/logger.scala
@@ -0,0 +1,153 @@
+/* 
+ * Copyright (c) 2010 Weigle Wilczek GmbH
+ * All rights reserved.
+ * 
+ * Permission is hereby granted, free  of charge, to any person obtaining
+ * a  copy  of this  software  and  associated  documentation files  (the
+ * "Software"), to  deal in  the Software without  restriction, including
+ * without limitation  the rights to  use, copy, modify,  merge, publish,
+ * distribute,  sublicense, and/or sell  copies of  the Software,  and to
+ * permit persons to whom the Software  is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The  above  copyright  notice  and  this permission  notice  shall  be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+ * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+ * MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+package org.slf4j.scala
+
+import org.slf4j.{ Logger => SLF4JLogger, LoggerFactory }
+
+/**
+ * Factory for Loggers.
+ */
+object Logger {
+
+  /**
+   * Creates a Logger named corresponding to the given class.
+   * @param clazz Class used for the Logger's name. Must not be null!
+   */
+  def apply(clazz: Class[_]) = {
+    require(clazz != null, "clazz must not be null!")
+    new DefaultLogger(LoggerFactory getLogger clazz)
+  }
+
+  /**
+   * Creates a Logger with the given name.
+   * @param name The Logger's name. Must not be null!
+   */
+  def apply(name: String) = {
+    require(name != null, "loggerName must not be null!")
+    new DefaultLogger(LoggerFactory getLogger name)
+  }
+}
+
+/**
+ * Thin wrapper for SLF4J making use of by-name parameters to improve performance.
+ */
+trait Logger {
+
+  /**
+   * The name of this Logger.
+   */
+  lazy val name = slf4jLogger.getName
+
+  /**
+   * Log a message with ERROR level.
+   * @param msg The message to be logged
+   */
+  def error(msg: => String) {
+    if (slf4jLogger.isErrorEnabled) slf4jLogger error msg
+  }
+
+  /**
+   * Log a message with ERROR level.
+   * @param msg The message to be logged
+   * @param t The Throwable to be logged
+   */
+  def error(msg: => String, t: Throwable) {
+    if (slf4jLogger.isErrorEnabled) slf4jLogger.error(msg, t)
+  }
+
+  /**
+   * Log a message with WARN level.
+   * @param msg The message to be logged
+   */
+  def warn(msg: => String) {
+    if (slf4jLogger.isWarnEnabled) slf4jLogger warn msg
+  }
+
+  /**
+   * Log a message with WARN level.
+   * @param msg The message to be logged
+   * @param t The Throwable to be logged
+   */
+  def warn(msg: => String, t: Throwable) {
+    if (slf4jLogger.isWarnEnabled) slf4jLogger.warn(msg, t)
+  }
+
+  /**
+   * Log a message with INFO level.
+   * @param msg The message to be logged
+   */
+  def info(msg: => String) {
+    if (slf4jLogger.isInfoEnabled) slf4jLogger info msg
+  }
+
+  /**
+   * Log a message with INFO level.
+   * @param msg The message to be logged
+   * @param t The Throwable to be logged
+   */
+  def info(msg: => String, t: Throwable) {
+    if (slf4jLogger.isInfoEnabled) slf4jLogger.info(msg, t)
+  }
+
+  /**
+   * Log a message with DEBUG level.
+   * @param msg The message to be logged
+   */
+  def debug(msg: => String) {
+    if (slf4jLogger.isDebugEnabled) slf4jLogger debug msg
+  }
+
+  /**
+   * Log a message with DEBUG level.
+   * @param msg The message to be logged
+   * @param t The Throwable to be logged
+   */
+  def debug(msg: => String, t: Throwable) {
+    if (slf4jLogger.isDebugEnabled) slf4jLogger.debug(msg, t)
+  }
+
+  /**
+   * Log a message with TRACE level.
+   * @param msg The message to be logged
+   */
+  def trace(msg: => String) {
+    if (slf4jLogger.isTraceEnabled) slf4jLogger trace msg
+  }
+
+  /**
+   * Log a message with TRACE level.
+   * @param msg The message to be logged
+   * @param t The Throwable to be logged
+   */
+  def trace(msg: => String, t: Throwable) {
+    if (slf4jLogger.isTraceEnabled) slf4jLogger.trace(msg, t)
+  }
+
+  /**
+   * The wrapped SLF4J Logger.
+   */
+  protected val slf4jLogger: SLF4JLogger
+}
+
+private[scala] class DefaultLogger(override protected val slf4jLogger: SLF4JLogger) extends Logger
diff --git a/slf4j-scala-api/src/test/scala/LoggerSpec.scala b/slf4j-scala-api/src/test/scala/LoggerSpec.scala
new file mode 100644
index 0000000..e48fd13
--- /dev/null
+++ b/slf4j-scala-api/src/test/scala/LoggerSpec.scala
@@ -0,0 +1,297 @@
+/* 
+ * Copyright (c) 2010 Weigle Wilczek GmbH
+ * All rights reserved.
+ * 
+ * Permission is hereby granted, free  of charge, to any person obtaining
+ * a  copy  of this  software  and  associated  documentation files  (the
+ * "Software"), to  deal in  the Software without  restriction, including
+ * without limitation  the rights to  use, copy, modify,  merge, publish,
+ * distribute,  sublicense, and/or sell  copies of  the Software,  and to
+ * permit persons to whom the Software  is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The  above  copyright  notice  and  this permission  notice  shall  be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+ * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+ * MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+package org.slf4j.scala
+
+import org.slf4j.{ Logger => SLF4JLogger }
+import org.specs.SpecificationWithJUnit
+import org.specs.mock.Mockito
+
+class LoggerSpec extends SpecificationWithJUnit with Mockito {
+
+  "Creating a Logger using Logger(clazz: Class[_])" should {
+
+    "return a Logger namend like the given class" in {
+      val clazz = classOf[String]
+      Logger(clazz).name mustEqual clazz.getName
+    }
+
+    "throw an IAE when creating a Logger with a null class" in {
+      Logger(null: Class[_]) must throwA[IllegalArgumentException]
+    }
+  }
+
+  "Creating a Logger using Logger(name: String)" should {
+
+    "return a Logger namend like the given name" in {
+      val name = "MyLogger"
+      Logger(name).name mustEqual name
+    }
+
+    "throw an IAE when creating a Logger with a null String" in {
+      Logger(null: String) must throwA [IllegalArgumentException]
+    }
+  }
+
+  "Calling Logger.error(msg)" should {
+    val (logger, slf4jLogger) = loggers
+    var evaluated = false
+    def msg = {
+      evaluated = true
+      Msg
+    }
+
+    "not call SLF4JLogger.error when error not enabled" in {
+      slf4jLogger.isErrorEnabled returns false
+      logger error msg
+      there was no(slf4jLogger).error(Msg)
+      evaluated mustBe false
+    }
+
+    "call SLF4JLogger.error when error enabled" in {
+      slf4jLogger.isErrorEnabled returns true
+      logger error msg
+      there was one(slf4jLogger).error(Msg)
+      evaluated mustBe true
+    }
+  }
+
+  "Calling Logger.error(msg, t)" should {
+    val (logger, slf4jLogger) = loggers
+    var evaluated = false
+    def msg = {
+      evaluated = true
+      Msg
+    }
+
+    "not call SLF4JLogger.error when error not enabled" in {
+      slf4jLogger.isErrorEnabled returns false
+      logger.error(msg, t)
+      there was no(slf4jLogger).error(Msg, t)
+      evaluated mustBe false
+    }
+
+    "call SLF4JLogger.error when error enabled" in {
+      slf4jLogger.isErrorEnabled returns true
+      logger.error(msg, t)
+      there was one(slf4jLogger).error(Msg ,t)
+      evaluated mustBe true
+    }
+  }
+
+  "Calling Logger.warn(msg)" should {
+    val (logger, slf4jLogger) = loggers
+    var evaluated = false
+    def msg = {
+      evaluated = true
+      Msg
+    }
+
+    "not call SLF4JLogger.warn when warn not enabled" in {
+      slf4jLogger.isWarnEnabled returns false
+      logger warn msg
+      there was no(slf4jLogger).warn(Msg)
+      evaluated mustBe false
+    }
+
+    "call SLF4JLogger.warn when warn enabled" in {
+      slf4jLogger.isWarnEnabled returns true
+      logger warn msg
+      there was one(slf4jLogger).warn(Msg)
+      evaluated mustBe true
+    }
+  }
+
+  "Calling Logger.warn(msg, t)" should {
+    val (logger, slf4jLogger) = loggers
+    var evaluated = false
+    def msg = {
+      evaluated = true
+      Msg
+    }
+
+    "not call SLF4JLogger.warn when warn not enabled" in {
+      slf4jLogger.isErrorEnabled returns false
+      logger.warn(msg, t)
+      there was no(slf4jLogger).warn(Msg, t)
+      evaluated mustBe false
+    }
+
+    "call SLF4JLogger.warn when warn enabled" in {
+      slf4jLogger.isWarnEnabled returns true
+      logger.warn(msg, t)
+      there was one(slf4jLogger).warn(Msg ,t)
+      evaluated mustBe true
+    }
+  }
+
+  "Calling Logger.info(msg)" should {
+    val (logger, slf4jLogger) = loggers
+    var evaluated = false
+    def msg = {
+      evaluated = true
+      Msg
+    }
+
+    "not call SLF4JLogger.info when info not enabled" in {
+      slf4jLogger.isInfoEnabled returns false
+      logger info msg
+      there was no(slf4jLogger).info(Msg)
+      evaluated mustBe false
+    }
+
+    "call SLF4JLogger.info when info enabled" in {
+      slf4jLogger.isInfoEnabled returns true
+      logger info msg
+      there was one(slf4jLogger).info(Msg)
+      evaluated mustBe true
+    }
+  }
+
+  "Calling Logger.info(msg, t)" should {
+    val (logger, slf4jLogger) = loggers
+    var evaluated = false
+    def msg = {
+      evaluated = true
+      Msg
+    }
+
+    "not call SLF4JLogger.info when info not enabled" in {
+      slf4jLogger.isInfoEnabled returns false
+      logger.info(msg, t)
+      there was no(slf4jLogger).info(Msg, t)
+      evaluated mustBe false
+    }
+
+    "call SLF4JLogger.info when info enabled" in {
+      slf4jLogger.isInfoEnabled returns true
+      logger.info(msg, t)
+      there was one(slf4jLogger).info(Msg, t)
+      evaluated mustBe true
+    }
+  }
+
+  "Calling Logger.debug(msg)" should {
+    val (logger, slf4jLogger) = loggers
+    var evaluated = false
+    def msg = {
+      evaluated = true
+      Msg
+    }
+
+    "not call SLF4JLogger.debug when debug not enabled" in {
+      slf4jLogger.isDebugEnabled returns false
+      logger debug msg
+      there was no(slf4jLogger).debug(Msg)
+      evaluated mustBe false
+    }
+
+    "call SLF4JLogger.debug when debug enabled" in {
+      slf4jLogger.isDebugEnabled returns true
+      logger debug msg
+      there was one(slf4jLogger).debug(Msg)
+      evaluated mustBe true
+    }
+  }
+
+  "Calling Logger.debug(msg ,t)" should {
+    val (logger, slf4jLogger) = loggers
+    var evaluated = false
+    def msg = {
+      evaluated = true
+      Msg
+    }
+
+    "not call SLF4JLogger.debug when debug not enabled" in {
+      slf4jLogger.isDebugEnabled returns false
+      logger.debug(msg, t)
+      there was no(slf4jLogger).debug(Msg, t)
+      evaluated mustBe false
+    }
+
+    "call SLF4JLogger.debug when debug enabled" in {
+      slf4jLogger.isDebugEnabled returns true
+      logger.debug(msg, t)
+      there was one(slf4jLogger).debug(Msg, t)
+      evaluated mustBe true
+    }
+  }
+
+  "Calling Logger.trace(msg)" should {
+    val (logger, slf4jLogger) = loggers
+    var evaluated = false
+    def msg = {
+      evaluated = true
+      Msg
+    }
+
+    "not call SLF4JLogger.trace when trace not enabled" in {
+      slf4jLogger.isTraceEnabled returns false
+      logger trace msg
+      there was no(slf4jLogger).trace(Msg)
+      evaluated mustBe false
+    }
+
+    "call SLF4JLogger.trace when trace enabled" in {
+      slf4jLogger.isTraceEnabled returns true
+      logger trace msg
+      there was one(slf4jLogger).trace(Msg)
+      evaluated mustBe true
+    }
+  }
+
+  "Calling Logger.trace(msg, t)" should {
+    val (logger, slf4jLogger) = loggers
+    var evaluated = false
+    def msg = {
+      evaluated = true
+      Msg
+    }
+
+    "not call SLF4JLogger.trace when trace not enabled" in {
+      slf4jLogger.isTraceEnabled returns false
+      logger.trace(msg, t)
+      there was no(slf4jLogger).trace(Msg, t)
+      evaluated mustBe false
+    }
+
+    "call SLF4JLogger.trace when trace enabled" in {
+      slf4jLogger.isTraceEnabled returns true
+      logger.trace(msg, t)
+      there was one(slf4jLogger).trace(Msg, t)
+      evaluated mustBe true
+    }
+  }
+
+  private lazy val Msg = "MESSAGE"
+
+  private lazy val t = new Throwable
+
+  private def loggers = {
+    val mockSLF4JLogger = mock[SLF4JLogger]
+    val logger = new Logger {
+      override protected val slf4jLogger = mockSLF4JLogger
+    }
+    (logger, mockSLF4JLogger)
+  }
+}
diff --git a/slf4j-scala-api/src/test/scala/LoggingSpec.scala b/slf4j-scala-api/src/test/scala/LoggingSpec.scala
new file mode 100644
index 0000000..b4599e0
--- /dev/null
+++ b/slf4j-scala-api/src/test/scala/LoggingSpec.scala
@@ -0,0 +1,38 @@
+/* 
+ * Copyright (c) 2010 Weigle Wilczek GmbH
+ * All rights reserved.
+ * 
+ * Permission is hereby granted, free  of charge, to any person obtaining
+ * a  copy  of this  software  and  associated  documentation files  (the
+ * "Software"), to  deal in  the Software without  restriction, including
+ * without limitation  the rights to  use, copy, modify,  merge, publish,
+ * distribute,  sublicense, and/or sell  copies of  the Software,  and to
+ * permit persons to whom the Software  is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The  above  copyright  notice  and  this permission  notice  shall  be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+ * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+ * MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+package org.slf4j.scala
+
+import org.specs.SpecificationWithJUnit
+
+class LoggingSpec extends SpecificationWithJUnit {
+
+  "Mixing Logging into SomeClass" should {
+    "yield a Logger named to SomeClass's FQCN" in {
+      val someClass = new SomeClass
+      someClass.logger.name mustEqual classOf[SomeClass].getName
+    }
+  }
+}
+
+class SomeClass extends Logging

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                         |    6 +-
 integration/pom.xml                                |    2 +-
 jcl-over-slf4j/pom.xml                             |    2 +-
 jul-to-slf4j/pom.xml                               |    2 +-
 log4j-over-slf4j/pom.xml                           |    2 +-
 osgi-over-slf4j/pom.xml                            |    2 +-
 pom.xml                                            |    5 +-
 slf4j-api/pom.xml                                  |    2 +-
 slf4j-ext/pom.xml                                  |    2 +-
 slf4j-jcl/pom.xml                                  |    2 +-
 slf4j-jdk14/pom.xml                                |    2 +-
 slf4j-log4j12/pom.xml                              |    2 +-
 slf4j-migrator/pom.xml                             |    2 +-
 slf4j-nop/pom.xml                                  |    2 +-
 slf4j-osgi-integration-test/pom.xml                |    2 +-
 slf4j-osgi-test-bundle/pom.xml                     |    2 +-
 slf4j-scala-api/pom.xml                            |  175 ++++++++++++
 .../src/main/scala/Logging.scala                   |   26 +-
 slf4j-scala-api/src/main/scala/logger.scala        |  153 ++++++++++
 slf4j-scala-api/src/test/scala/LoggerSpec.scala    |  297 ++++++++++++++++++++
 .../src/test/scala/LoggingSpec.scala               |   24 +-
 slf4j-simple/pom.xml                               |    2 +-
 slf4j-site/pom.xml                                 |    2 +-
 23 files changed, 672 insertions(+), 46 deletions(-)
 create mode 100644 slf4j-scala-api/pom.xml
 copy slf4j-ext/src/main/java/org/slf4j/profiler/TimeInstrumentStatus.java => slf4j-scala-api/src/main/scala/Logging.scala (80%)
 create mode 100644 slf4j-scala-api/src/main/scala/logger.scala
 create mode 100644 slf4j-scala-api/src/test/scala/LoggerSpec.scala
 copy slf4j-migrator/src/test/java/org/slf4j/migrator/PackageTest.java => slf4j-scala-api/src/test/scala/LoggingSpec.scala (74%)


hooks/post-receive
-- 
SLF4J: Simple Logging Facade for Java


More information about the slf4j-dev mailing list