effect Logger {
    fn log(level: String, msg: String): Unit
    fn getLevel(): String
}

fn processData(data: Int): Int with {Logger} = {
    Logger.log("info", "Processing data...")
    let result = data * 2
    Logger.log("debug", "Result computed")
    result
}

handler consoleLogger: Logger {
    fn log(level, msg) = Console.print("[" + level + "] " + msg)
    fn getLevel() = "debug"
}

fn main(): Unit with {Console} = {
    let result = run processData(21) with {
    Logger = consoleLogger,
}
    Console.print("Final result: " + toString(result))
}

let output = run main() with {}
