@@ -22,6 +22,7 @@ import io.getstream.log.Priority.INFO
2222import io.getstream.log.Priority.VERBOSE
2323import io.getstream.log.Priority.WARN
2424import kotlin.concurrent.Volatile
25+ import kotlin.jvm.JvmOverloads
2526import kotlin.jvm.JvmStatic
2627
2728/* *
@@ -112,25 +113,13 @@ public object StreamLog {
112113 * @param message The function returning a message you would like logged.
113114 */
114115 @JvmStatic
115- public inline fun e (tag : String , throwable : Throwable , message : () -> String ) {
116+ @JvmOverloads
117+ public inline fun e (tag : String , throwable : Throwable ? = null, message : () -> String ) {
116118 if (internalValidator.isLoggable(ERROR , tag)) {
117119 internalLogger.log(ERROR , tag, message(), throwable)
118120 }
119121 }
120122
121- /* *
122- * Send a [ERROR] log message.
123- *
124- * @param tag Used to identify the source of a log message.
125- * @param message The function returning a message you would like logged.
126- */
127- @JvmStatic
128- public inline fun e (tag : String , message : () -> String ) {
129- if (internalValidator.isLoggable(ERROR , tag)) {
130- internalLogger.log(ERROR , tag, message())
131- }
132- }
133-
134123 /* *
135124 * Send a [WARN] log message.
136125 *
@@ -206,17 +195,13 @@ public object StreamLog {
206195 */
207196 @JvmStatic
208197 public inline fun log (priority : Priority , tag : String , throwable : Throwable ? = null, message : () -> String ) {
209- if (throwable != null ) {
210- e(tag, throwable, message)
211- } else {
212- when (priority) {
213- VERBOSE -> v(tag, message)
214- DEBUG -> d(tag, message)
215- INFO -> i(tag, message)
216- WARN -> w(tag, message)
217- ERROR -> e(tag, message)
218- ASSERT -> a(tag, message)
219- }
198+ when (priority) {
199+ VERBOSE -> v(tag, message)
200+ DEBUG -> d(tag, message)
201+ INFO -> i(tag, message)
202+ WARN -> w(tag, message)
203+ ERROR -> e(tag, throwable, message)
204+ ASSERT -> a(tag, message)
220205 }
221206 }
222207}
@@ -250,23 +235,13 @@ public class TaggedLogger(
250235 * @param throwable An exception to log.
251236 * @param message The function returning a message you would like logged.
252237 */
253- public inline fun e (throwable : Throwable , message : () -> String ) {
238+ @JvmOverloads
239+ public inline fun e (throwable : Throwable ? = null, message : () -> String ) {
254240 if (validator.isLoggable(ERROR , tag)) {
255241 delegate.log(ERROR , tag, message(), throwable)
256242 }
257243 }
258244
259- /* *
260- * Send a [ERROR] log message.
261- *
262- * @param message The function returning a message you would like logged.
263- */
264- public inline fun e (message : () -> String ) {
265- if (validator.isLoggable(ERROR , tag)) {
266- delegate.log(ERROR , tag, message())
267- }
268- }
269-
270245 /* *
271246 * Send a [WARN] log message.
272247 *
0 commit comments