-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,128 +1,130 @@ | ||
buildscript { | ||
ext.kotlin_version = '1.2.10' | ||
apply from: 'versions.gradle' | ||
|
||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' | ||
} | ||
} | ||
|
||
plugins { | ||
id "com.jfrog.bintray" version "1.7" | ||
allprojects { | ||
group 'io.github.microutils' | ||
version '1.5.3' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
} | ||
|
||
group 'MicroUtils' | ||
version '1.4.8' | ||
apply plugin: 'kotlin' | ||
|
||
subprojects { | ||
|
||
apply plugin: 'maven-publish' | ||
apply plugin: 'com.jfrog.bintray' | ||
|
||
def varintName = "kotlin-logging" | ||
|
||
apply plugin: 'kotlin' | ||
// Apply the java plugin to add support for Java | ||
apply plugin: 'java' | ||
apply plugin: 'maven' | ||
apply plugin: 'maven-publish' | ||
sourceCompatibility = 1.6 | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
if (project.name != "kotlin-logging-jvm") { | ||
varintName = "${project.name}" | ||
} | ||
|
||
dependencies { | ||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
compile "org.slf4j:slf4j-api:1.7.25" | ||
testCompile "org.slf4j:slf4j-log4j12:1.7.25" | ||
testCompile "log4j:log4j:1.2.17" | ||
testCompile "org.mockito:mockito-all:1.10.19" | ||
testCompile 'junit:junit:4.12' | ||
} | ||
afterEvaluate { | ||
task sourceJar(type: Jar, dependsOn: classes) { | ||
classifier 'sources' | ||
from sourceSets.main.kotlin | ||
duplicatesStrategy = "exclude" | ||
def platformSrc = sourceSets.main.kotlin | ||
def commonSrc = project(':kotlin-logging-common').sourceSets.main.kotlin | ||
from (platformSrc + commonSrc) | ||
} | ||
|
||
//https://github.com/bintray/gradle-bintray-plugin | ||
bintray { | ||
user = 'oshai' | ||
key = 'my_key' //https://bintray.com/profile/edit | ||
publications = ['MyPublication'] | ||
pkg { | ||
repo = 'kotlin-logging' | ||
name = 'kotlin-logging' | ||
userOrg = 'microutils' | ||
licenses = ['Apache-2.0'] | ||
vcsUrl = 'https://github.com/MicroUtils/kotlin-logging' | ||
version { | ||
name = '1.4.8' | ||
desc = "kotlin-logging 1.4.8 - Lightweight logging framework for Kotlin" | ||
released = new Date() | ||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
} | ||
} | ||
|
||
// kotlin compiler compatibility options | ||
compileKotlin { | ||
kotlinOptions { | ||
apiVersion = "1.0" | ||
languageVersion = "1.0" | ||
tasks.withType(Jar) { | ||
archivesBaseName = varintName | ||
} | ||
} | ||
|
||
// custom tasks for creating source/javadoc jars | ||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
// add javadoc/source jar tasks as artifacts | ||
artifacts { | ||
archives sourcesJar, javadocJar | ||
} | ||
def pomConfig = { | ||
name "kotlin-logging" | ||
description "kotlin-logging $version - Lightweight logging framework for Kotlin" | ||
url "https://github.com/MicroUtils/kotlin-logging" | ||
|
||
def pomConfig = { | ||
name "kotlin-logging" | ||
description "kotlin-logging $version - Lightweight logging framework for Kotlin" | ||
url "https://github.com/MicroUtils/kotlin-logging" | ||
|
||
scm { | ||
url "http://github.com/MicroUtils/kotlin-logging/tree/master" | ||
connection "scm:git:git://github.com/MicroUtils/kotlin-logging.git" | ||
developerConnection "scm:git:ssh://github.com:MicroUtils/kotlin-logging.git" | ||
} | ||
licenses { | ||
license { | ||
name "The Apache Software License, Version 2.0" | ||
url "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
scm { | ||
url "http://github.com/MicroUtils/kotlin-logging/tree/master" | ||
connection "scm:git:git://github.com/MicroUtils/kotlin-logging.git" | ||
developerConnection "scm:git:ssh://github.com:MicroUtils/kotlin-logging.git" | ||
} | ||
} | ||
developers { | ||
developer { | ||
name "Ohad Shai" | ||
email "[email protected]" | ||
organization "github" | ||
organizationUrl "http://www.github.com" | ||
licenses { | ||
license { | ||
name "The Apache Software License, Version 2.0" | ||
url "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
} | ||
} | ||
developers { | ||
developer { | ||
name "Ohad Shai" | ||
email "[email protected]" | ||
organization "github" | ||
organizationUrl "http://www.github.com" | ||
} | ||
} | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
MyPublication(MavenPublication) { | ||
pom.withXml { | ||
def root = asNode() | ||
root.appendNode('description', "kotlin-logging $version - Lightweight logging framework for Kotlin") | ||
root.children().last() + pomConfig | ||
publishing { | ||
publications { | ||
mavenProject(MavenPublication) { | ||
from components.java | ||
groupId project.group | ||
artifactId varintName | ||
version project.version | ||
|
||
pom.withXml { | ||
def root = asNode() | ||
root.appendNode('description', "kotlin-logging $version - Lightweight logging framework for Kotlin") | ||
root.children().last() + pomConfig | ||
} | ||
|
||
|
||
artifact sourceJar { | ||
classifier "sources" | ||
} | ||
artifact javadocJar { | ||
classifier "javadoc" | ||
} | ||
} | ||
from components.java | ||
groupId 'io.github.microutils' | ||
artifactId 'kotlin-logging' | ||
version version | ||
} | ||
} | ||
|
||
artifact sourcesJar | ||
artifact javadocJar | ||
bintray { | ||
user = 'oshai'//project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') | ||
key = 'mykey' //https://bintray.com/profile/edit | ||
// project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') | ||
publications = ['mavenProject'] | ||
pkg { | ||
repo = 'kotlin-logging' | ||
name = 'kotlin-logging' | ||
userOrg = 'microutils' | ||
licenses = ['Apache-2.0'] | ||
vcsUrl = 'https://github.com/MicroUtils/kotlin-logging' | ||
websiteUrl = 'https://github.com/MicroUtils/kotlin-logging' | ||
issueTrackerUrl = 'https://github.com/MicroUtils/kotlin-logging/issues' | ||
|
||
githubRepo = 'MicroUtils/kotlin-logging' | ||
version { | ||
name = project.version | ||
desc = "kotlin-logging - Lightweight logging framework for Kotlin" | ||
released = new Date() | ||
} | ||
} | ||
} | ||
} | ||
|
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.