Skip to content

Conversation

@SmilingPixel
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings January 13, 2026 01:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a cross-platform logging utility for a Kotlin Multiplatform Compose application. It provides a common Logger interface with platform-specific implementations for Android, JVM, and WasmJs.

Changes:

  • Added common Logger interface with LogLevel enum and convenience extension functions
  • Implemented Android-specific logger using Android's Log API
  • Implemented JVM-specific logger using System.out/err
  • Implemented WasmJs-specific logger using println

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
composeApp/src/commonMain/kotlin/io/github/smiling_pixel/util/Logger.kt Defines the common Logger interface, LogLevel enum, and convenience extension functions for logging
composeApp/src/androidMain/kotlin/io/github/smiling_pixel/util/Logger.android.kt Android implementation using android.util.Log API
composeApp/src/jvmMain/kotlin/io/github/smiling_pixel/util/Logger.jvm.kt JVM implementation routing ERROR to System.err and other levels to System.out
composeApp/src/wasmJsMain/kotlin/io/github/smiling_pixel/util/Logger.wasmJs.kt WasmJs implementation using println for console logging

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to +8
expect object Logger {
fun log(level: LogLevel, tag: String, message: String)
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing iOS implementation for Logger. The project's build.gradle.kts configures iOS targets (iosArm64 and iosSimulatorArm64), but there is no corresponding Logger.ios.kt file in composeApp/src/iosMain/kotlin/io/github/smiling_pixel/util/. This will cause a compilation error for iOS targets. An iOS implementation should use NSLog or print for logging.

Suggested change
expect object Logger {
fun log(level: LogLevel, tag: String, message: String)
object Logger {
fun log(level: LogLevel, tag: String, message: String) {
println("[$level][$tag] $message")
}

Copilot uses AI. Check for mistakes.

actual object Logger {
actual fun log(level: LogLevel, tag: String, message: String) {
val stream = if (level == LogLevel.ERROR) System.err else System.out
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WARN log level is currently being written to System.out. Consider routing WARN messages to System.err as well, since warnings typically indicate potential problems that should be visible in error streams. This would be more consistent with common logging practices where both warnings and errors are sent to stderr.

Suggested change
val stream = if (level == LogLevel.ERROR) System.err else System.out
val stream = if (level == LogLevel.ERROR || level == LogLevel.WARN) System.err else System.out

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 3 to 4
enum class LogLevel {
DEBUG, INFO, WARN, ERROR
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing documentation for the LogLevel enum. The enum should have KDoc comments explaining what each log level represents and when it should be used (e.g., DEBUG for debugging information, INFO for informational messages, WARN for warning messages, ERROR for error conditions).

Suggested change
enum class LogLevel {
DEBUG, INFO, WARN, ERROR
/**
* Represents the severity of a log message.
*
* Loggers can use this level to filter or format output depending on
* how important or noisy a given message is.
*/
enum class LogLevel {
/**
* Fine‑grained diagnostic information that is useful during development
* and troubleshooting, but typically too verbose for production logs.
*/
DEBUG,
/**
* General informational messages that describe the normal flow of the
* application, such as lifecycle events or high‑level state changes.
*/
INFO,
/**
* Potential problems or unusual situations that are not necessarily
* errors but might require attention or investigation.
*/
WARN,
/**
* Error conditions indicating that an operation has failed or that the
* application is in an unexpected state and may not be able to continue
* normally.
*/
ERROR

Copilot uses AI. Check for mistakes.
Comment on lines 10 to 13

fun Logger.d(tag: String, message: String) = log(LogLevel.DEBUG, tag, message)
fun Logger.i(tag: String, message: String) = log(LogLevel.INFO, tag, message)
fun Logger.w(tag: String, message: String) = log(LogLevel.WARN, tag, message)
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing documentation for the extension functions. These convenience functions (d, i, w, e) provide a simpler API for logging but lack KDoc comments explaining their purpose and parameters. Consider adding documentation that clarifies they are shorthand methods for the different log levels.

Suggested change
fun Logger.d(tag: String, message: String) = log(LogLevel.DEBUG, tag, message)
fun Logger.i(tag: String, message: String) = log(LogLevel.INFO, tag, message)
fun Logger.w(tag: String, message: String) = log(LogLevel.WARN, tag, message)
/**
* Logs a debug-level message using this [Logger].
*
* Shorthand for calling [log] with [LogLevel.DEBUG].
*
* @param tag A short tag identifying the log source.
* @param message The message to be logged.
*/
fun Logger.d(tag: String, message: String) = log(LogLevel.DEBUG, tag, message)
/**
* Logs an info-level message using this [Logger].
*
* Shorthand for calling [log] with [LogLevel.INFO].
*
* @param tag A short tag identifying the log source.
* @param message The message to be logged.
*/
fun Logger.i(tag: String, message: String) = log(LogLevel.INFO, tag, message)
/**
* Logs a warning-level message using this [Logger].
*
* Shorthand for calling [log] with [LogLevel.WARN].
*
* @param tag A short tag identifying the log source.
* @param message The message to be logged.
*/
fun Logger.w(tag: String, message: String) = log(LogLevel.WARN, tag, message)
/**
* Logs an error-level message using this [Logger].
*
* Shorthand for calling [log] with [LogLevel.ERROR].
*
* @param tag A short tag identifying the log source.
* @param message The message to be logged.
*/

Copilot uses AI. Check for mistakes.
@SmilingPixel
Copy link
Owner Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Jan 15, 2026

@SmilingPixel I've opened a new pull request, #12, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 3 commits January 15, 2026 02:04
Co-authored-by: SmilingPixel <73827509+SmilingPixel@users.noreply.github.com>
Co-authored-by: SmilingPixel <73827509+SmilingPixel@users.noreply.github.com>
@SmilingPixel SmilingPixel merged commit cb6c86c into main Jan 16, 2026
2 checks passed
@SmilingPixel SmilingPixel deleted the feat/logging_0112 branch January 16, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants