-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6929a3
commit 5992bae
Showing
11 changed files
with
120 additions
and
89 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
16 changes: 0 additions & 16 deletions
16
core/src/main/kotlin/com/hexagonkt/core/logging/PrintLogger.kt
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
core/src/main/kotlin/com/hexagonkt/core/logging/SystemLogger.kt
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,28 @@ | ||
package com.hexagonkt.core.logging | ||
|
||
import com.hexagonkt.core.logging.LoggingLevel.* | ||
|
||
data class SystemLogger(val name: String) : LoggerPort { | ||
|
||
private val logger: System.Logger = System.getLogger(name) | ||
|
||
override fun <E : Throwable> log(level: LoggingLevel, exception: E, message: (E) -> Any?) { | ||
if (LoggingManager.isLoggerLevelEnabled(name, level)) | ||
logger.log(level(level), message(exception).toString(), exception) | ||
} | ||
|
||
override fun log(level: LoggingLevel, message: () -> Any?) { | ||
if (LoggingManager.isLoggerLevelEnabled(name, level)) | ||
logger.log(level(level), message()) | ||
} | ||
|
||
private fun level(level: LoggingLevel): System.Logger.Level = | ||
when (level) { | ||
TRACE -> System.Logger.Level.TRACE | ||
DEBUG -> System.Logger.Level.DEBUG | ||
INFO -> System.Logger.Level.INFO | ||
WARN -> System.Logger.Level.WARNING | ||
ERROR -> System.Logger.Level.ERROR | ||
OFF -> System.Logger.Level.OFF | ||
} | ||
} |
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
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
Oops, something went wrong.