From 067938657f447b4af964df5bb3dee77806354e88 Mon Sep 17 00:00:00 2001 From: davotoula Date: Sat, 28 Mar 2026 01:09:27 +0100 Subject: [PATCH] feat: add LogLevel enum and PlatformLog expect declaration Co-Authored-By: Claude Opus 4.6 --- .../vitorpamplona/quartz/utils/LogLevel.kt | 24 ++++++++++ .../vitorpamplona/quartz/utils/PlatformLog.kt | 45 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/LogLevel.kt create mode 100644 quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/PlatformLog.kt diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/LogLevel.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/LogLevel.kt new file mode 100644 index 000000000..279462063 --- /dev/null +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/LogLevel.kt @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Vitor Pamplona + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.vitorpamplona.quartz.utils + +/** Ordered by severity -- do not reorder. Filtering uses ordinal comparison. */ +enum class LogLevel { DEBUG, INFO, WARN, ERROR } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/PlatformLog.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/PlatformLog.kt new file mode 100644 index 000000000..ecc325422 --- /dev/null +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/PlatformLog.kt @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2025 Vitor Pamplona + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.vitorpamplona.quartz.utils + +expect object PlatformLog { + fun w( + tag: String, + message: String, + throwable: Throwable? = null, + ) + + fun e( + tag: String, + message: String, + throwable: Throwable? = null, + ) + + fun d( + tag: String, + message: String, + ) + + fun i( + tag: String, + message: String, + ) +}