This commit is contained in:
2026-05-10 03:35:13 +02:00
parent 0c2746eefc
commit 5a475f3b8a
7 changed files with 193 additions and 15 deletions
+41
View File
@@ -0,0 +1,41 @@
public enum LogLevel {
Info,
Warning,
Error,
}
public class Logger {
String prefix;
public constructor(String prefix) {
self.prefix = prefix;
}
public void info(self*, String message) {
self.log(LogLevel::Info, message);
}
public void warning(self*, String message) {
self.log(LogLevel::Warning, message);
}
public void error(self*, String message) {
self.log(LogLevel::Error, message);
}
void log(self*, LogLevel level, String message) {
match(level) {
LogLevel::Info => {
println!("[INFO] {} {}", self.prefix, message);
}
LogLevel::Warning => {
println!("[WARN] {} {}", self.prefix, message);
}
LogLevel::Error => {
println!("[ERROR] {} {}", self.prefix, message);
}
}
}
}