-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* issue #21 - make the lib multiplatform - split to common/jvm/js - left all code in jvm at the moment - add build scripts * issue #31 - Add MDC support: withLoggingContext * merge to branch: issue #31 - Add MDC support: withLoggingContext * add documentation * rebase (#33) * issue #31 - Add MDC support: withLoggingContext * Update ChangleLog.md * Update ChangleLog.md * Update README.md * Rename ChangleLog.md to ChangeLog.md (#32) * update to kotlin 1.2.20 * split packages and gradle build * split packages and gradle build * split packages and gradle build * fix src root for jvm project * fix artifact build for jvm version
- Loading branch information
Showing
23 changed files
with
349 additions
and
184 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apply plugin: 'kotlin-platform-common' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version" | ||
} |
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,27 @@ | ||
apply plugin: 'kotlin-platform-js' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
sourceSets { | ||
main { | ||
kotlin { | ||
srcDirs = ['src', '../kotlin-logging-common/src'] | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" | ||
expectedBy project(':kotlin-logging-common') | ||
} | ||
|
||
def target = "${projectDir}/build/classes/main" | ||
|
||
compileKotlin2Js { | ||
kotlinOptions.metaInfo = true | ||
kotlinOptions.outputFile = "$target/kotlin-logging.js" | ||
kotlinOptions.sourceMap = true | ||
kotlinOptions.moduleKind = 'umd' | ||
} |
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,41 @@ | ||
apply plugin: 'kotlin-platform-jvm' | ||
|
||
buildscript { | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
} | ||
} | ||
sourceCompatibility = 1.6 | ||
|
||
compileKotlin { | ||
kotlinOptions.jvmTarget = "1.6" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
expectedBy project(':kotlin-logging-common') | ||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
compile "org.slf4j:slf4j-api:$sl4j_version" | ||
testCompile "org.slf4j:slf4j-log4j12:$sl4j_version" | ||
testCompile "log4j:log4j:1.2.17" | ||
testCompile "org.mockito:mockito-all:1.10.19" | ||
testCompile 'junit:junit:4.12' | ||
} | ||
|
||
// kotlin compiler compatibility options | ||
compileKotlin { | ||
kotlinOptions { | ||
apiVersion = "1.0" | ||
languageVersion = "1.0" | ||
} | ||
} | ||
|
||
|
||
|
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,87 @@ | ||
package mu | ||
|
||
import mu.internal.toStringSafe | ||
import org.slf4j.Logger | ||
|
||
/** | ||
* An extension for [Logger] with Lazy message evaluation | ||
* example: | ||
* logger.info{"this is $lazy evaluated string"} | ||
*/ | ||
interface KLogger : Logger { | ||
|
||
/** | ||
* The actual logger executing logging | ||
*/ | ||
val underlyingLogger: Logger | ||
|
||
/** | ||
* Lazy add a log message if isTraceEnabled is true | ||
*/ | ||
fun trace(msg: () -> Any?) { | ||
if (isTraceEnabled) trace(msg.toStringSafe()) | ||
} | ||
|
||
/** | ||
* Lazy add a log message if isDebugEnabled is true | ||
*/ | ||
fun debug(msg: () -> Any?) { | ||
if (isDebugEnabled) debug(msg.toStringSafe()) | ||
} | ||
|
||
/** | ||
* Lazy add a log message if isInfoEnabled is true | ||
*/ | ||
fun info(msg: () -> Any?) { | ||
if (isInfoEnabled) info(msg.toStringSafe()) | ||
} | ||
|
||
/** | ||
* Lazy add a log message if isWarnEnabled is true | ||
*/ | ||
fun warn(msg: () -> Any?) { | ||
if (isWarnEnabled) warn(msg.toStringSafe()) | ||
} | ||
|
||
/** | ||
* Lazy add a log message if isErrorEnabled is true | ||
*/ | ||
fun error(msg: () -> Any?) { | ||
if (isErrorEnabled) error(msg.toStringSafe()) | ||
} | ||
|
||
/** | ||
* Lazy add a log message with throwable payload if isTraceEnabled is true | ||
*/ | ||
fun trace(t: Throwable, msg: () -> Any?) { | ||
if (isTraceEnabled) trace(msg.toStringSafe(), t) | ||
} | ||
|
||
/** | ||
* Lazy add a log message with throwable payload if isDebugEnabled is true | ||
*/ | ||
fun debug(t: Throwable, msg: () -> Any?) { | ||
if (isDebugEnabled) debug(msg.toStringSafe(), t) | ||
} | ||
|
||
/** | ||
* Lazy add a log message with throwable payload if isInfoEnabled is true | ||
*/ | ||
fun info(t: Throwable, msg: () -> Any?) { | ||
if (isInfoEnabled) info(msg.toStringSafe(), t) | ||
} | ||
|
||
/** | ||
* Lazy add a log message with throwable payload if isWarnEnabled is true | ||
*/ | ||
fun warn(t: Throwable, msg: () -> Any?) { | ||
if (isWarnEnabled) warn(msg.toStringSafe(), t) | ||
} | ||
|
||
/** | ||
* Lazy add a log message with throwable payload if isErrorEnabled is true | ||
*/ | ||
fun error(t: Throwable, msg: () -> Any?) { | ||
if (isErrorEnabled) error(msg.toStringSafe(), t) | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.