diff --git a/src/kernel/log/Log.hx b/src/kernel/log/Log.hx index 917b1aa..74c969c 100644 --- a/src/kernel/log/Log.hx +++ b/src/kernel/log/Log.hx @@ -25,28 +25,29 @@ class Log { } public static function info(msg:Dynamic, ?pos:haxe.PosInfos) { - instance.log({level: Info, message: Std.string(msg),time: 0}); + instance.log({level: Info, message: Std.string(msg),time: 0},pos); } public static function warn(msg:Dynamic, ?pos:haxe.PosInfos) { - instance.log({level: Warn, message: Std.string(msg),time: 0}); + instance.log({level: Warn, message: Std.string(msg),time: 0},pos); } public static function error(msg:Dynamic, ?pos:haxe.PosInfos) { - instance.log({level: Error, message: Std.string(msg),time: 0}); + instance.log({level: Error, message: Std.string(msg),time: 0},pos); } public static function debug(msg:Dynamic, ?pos:haxe.PosInfos) { #if debug - instance.log({level: Debug, message: Std.string(msg),time: 0}); + instance.log({level: Debug, message: Std.string(msg),time: 0},pos); #end } public static function silly(msg:Dynamic, ?pos:haxe.PosInfos) { - instance.log({level: Silly, message: Std.string(msg),time: 0}); + instance.log({level: Silly, message: Std.string(msg),time: 0},pos); } private function log(line: LogLine, ?pos:haxe.PosInfos) { + line.origin = pos.className; logLines.push(line); if (logLines.length > MAX_LINES) { @@ -54,7 +55,7 @@ class Log { } #if webconsole - Debug.printWeb('[${Std.string(line.level)}] ${line.message}'); + Debug.printWeb('[${Std.string(line.level)}][${line.origin}] ${line.message}'); #end onLogTrigger.trigger(line); diff --git a/src/kernel/log/LogLine.hx b/src/kernel/log/LogLine.hx index 5a5c248..42842e5 100644 --- a/src/kernel/log/LogLine.hx +++ b/src/kernel/log/LogLine.hx @@ -4,4 +4,5 @@ typedef LogLine = { level: LogLevel, message: String, time: Int, + ?origin: String, }