-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #242 from RocketChat/develop
[RELEASE] Merge DEVELOP into MASTER
- Loading branch information
Showing
64 changed files
with
869 additions
and
627 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,4 +1,7 @@ | ||
version: 2 | ||
build: | ||
machine: | ||
java: oraclejdk8 | ||
jobs: | ||
formatting: | ||
docker: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
package chat.rocket.common.util | ||
|
||
class Logger(val platformLogger: PlatformLogger, private val url: String) { | ||
interface Logger { | ||
fun debug(msg: () -> Any?) | ||
fun info(msg: () -> Any?) | ||
fun warn(msg: () -> Any?) | ||
} | ||
|
||
val enabled: Boolean = true | ||
class RealLogger(val platformLogger: PlatformLogger, private val url: String) : Logger { | ||
|
||
fun debug(msg: () -> Any?) { | ||
if (enabled) platformLogger.debug("SDK($url): ${msg.toStringSafe()}") | ||
|
||
override fun debug(msg: () -> Any?) { | ||
platformLogger.debug("SDK($url): ${msg.toStringSafe()}") | ||
} | ||
|
||
override fun info(msg: () -> Any?) { | ||
platformLogger.info("SDK($url): ${msg.toStringSafe()}") | ||
} | ||
|
||
override fun warn(msg: () -> Any?) { | ||
platformLogger.warn("SDK($url): ${msg.toStringSafe()}") | ||
} | ||
} | ||
|
||
object NoOpLogger : Logger { | ||
override fun debug(msg: () -> Any?) { | ||
} | ||
|
||
fun info(msg: () -> Any?) { | ||
if (enabled) platformLogger.info("SDK($url): ${msg.toStringSafe()}") | ||
override fun info(msg: () -> Any?) { | ||
} | ||
|
||
fun warn(msg: () -> Any?) { | ||
if (enabled) platformLogger.warn("SDK($url): ${msg.toStringSafe()}") | ||
override fun warn(msg: () -> Any?) { | ||
} | ||
} |
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
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.