-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add note for building with Dotty * Split sources for Scala 2 and 3 * Fix Scala 2.13 warnings * Using quoted macro * Add a simple test for Dotty * Fix compiler option for Dotty * Add projectDotty for publishing Scala 3.x artifacts
- Loading branch information
Showing
15 changed files
with
413 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,21 @@ jobs: | |
restore-keys: ${{ runner.os }}-scala-2.13- | ||
- name: Scala 2.13 test | ||
run: ./sbt ++2.13.4 projectJVM/test | ||
test_3: | ||
name: Scala 3.x (Dotty) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: olafurpg/setup-scala@v10 | ||
with: | ||
java-version: [email protected] | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache | ||
key: ${{ runner.os }}-scala-3-${{ hashFiles('**/*.sbt') }} | ||
restore-keys: ${{ runner.os }}-scala-3- | ||
- name: Scala 3.x test | ||
run: DOTTY=true ./sbt dottyTest/run | ||
test_js: | ||
name: Scala.js / Scala 2.12 | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
airframe-dotty-test/src/main/scala/dotty/test/LogTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package dotty.test | ||
|
||
import wvlet.log.{LogFormatter, LogLevel, LogSupport, Logger} | ||
|
||
object LogTest extends LogSupport { | ||
|
||
def main(args: Array[String]): Unit = { | ||
//Logger.setDefaultFormatter(LogFormatter.SourceCodeLogFormatter) | ||
info("Hello airframe-log") | ||
debug("Hello airframe-log") | ||
error("Hello airframe-log") | ||
warn("Hello airframe-log") | ||
trace("Hello airframe-log") | ||
|
||
logger.info("direct log") | ||
logger.debug("direct log") | ||
logger.trace("direct log") | ||
logger.warn("direct log") | ||
logger.error("direct log") | ||
|
||
logger.setLogLevel(LogLevel.TRACE) | ||
logger.info("direct log") | ||
logger.debug("direct log") | ||
logger.trace("direct log") | ||
logger.warn("direct log") | ||
logger.error("direct log") | ||
|
||
logger.setLogLevel(LogLevel.WARN) | ||
info("Hello airframe-log") | ||
debug("Hello airframe-log") | ||
error("Hello airframe-log") | ||
warn("Hello airframe-log") | ||
trace("Hello airframe-log") | ||
|
||
warn("exception log test", new IllegalArgumentException("invalid arg")) | ||
|
||
Logger.setDefaultLogLevel(LogLevel.INFO) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
67 changes: 67 additions & 0 deletions
67
airframe-log/shared/src/main/scala-2/wvlet/log/LoggerBase.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package wvlet.log | ||
import scala.language.experimental.macros | ||
|
||
/** | ||
*/ | ||
trait LoggerBase { | ||
import LogMacros._ | ||
|
||
def error(message: Any): Unit = macro errorLogMethod | ||
def error(message: Any, cause: Throwable): Unit = | ||
macro errorLogMethodWithCause | ||
|
||
def warn(message: Any): Unit = macro warnLogMethod | ||
def warn(message: Any, cause: Throwable): Unit = macro warnLogMethodWithCause | ||
|
||
def info(message: Any): Unit = macro infoLogMethod | ||
def info(message: Any, cause: Throwable): Unit = macro infoLogMethodWithCause | ||
|
||
def debug(message: Any): Unit = macro debugLogMethod | ||
def debug(message: Any, cause: Throwable): Unit = | ||
macro debugLogMethodWithCause | ||
|
||
def trace(message: Any): Unit = macro traceLogMethod | ||
def trace(message: Any, cause: Throwable): Unit = | ||
macro traceLogMethodWithCause | ||
} | ||
|
||
/** | ||
*/ | ||
trait LoggingMethods extends Serializable { | ||
import wvlet.log.LogMacros._ | ||
|
||
protected def error(message: Any): Unit = macro errorLog | ||
protected def error(message: Any, cause: Throwable): Unit = | ||
macro errorLogWithCause | ||
|
||
protected def warn(message: Any): Unit = macro warnLog | ||
protected def warn(message: Any, cause: Throwable): Unit = | ||
macro warnLogWithCause | ||
|
||
protected def info(message: Any): Unit = macro infoLog | ||
protected def info(message: Any, cause: Throwable): Unit = | ||
macro infoLogWithCause | ||
|
||
protected def debug(message: Any): Unit = macro debugLog | ||
protected def debug(message: Any, cause: Throwable): Unit = | ||
macro debugLogWithCause | ||
|
||
protected def trace(message: Any): Unit = macro traceLog | ||
protected def trace(message: Any, cause: Throwable): Unit = | ||
macro traceLogWithCause | ||
|
||
protected def logAt(logLevel: LogLevel, message: Any): Unit = macro logAtImpl | ||
} |
Oops, something went wrong.