Cleaned up Warning And Error Code

This commit is contained in:
NeeEoo
2024-04-10 16:37:19 +02:00
parent a8f35ad81c
commit d955e00ece
33 changed files with 106 additions and 93 deletions
+12
View File
@@ -104,6 +104,18 @@ class Logs {
color: color
}], level);
}
public inline static function verbose(text:String, level:Level = VERBOSE, color:ConsoleColor = LIGHTGRAY) {
Logs.trace(text, level, color);
}
public inline static function warn(text:String, level:Level = WARNING, color:ConsoleColor = YELLOW) {
Logs.trace(text, level, color);
}
public inline static function error(text:String, level:Level = ERROR, color:ConsoleColor = RED) {
Logs.trace(text, level, color);
}
}
enum abstract Level(Int) {
+1 -1
View File
@@ -71,7 +71,7 @@ class MainState extends FlxState {
sys.FileSystem.createDirectory('./.temp/');
#if windows
try new funkin.backend.utils.native.HiddenProcess("attrib +h .temp")
catch(e) Logs.trace('Failed to set hidden attribute on .temp folder', WARNING);
catch(e) Logs.warn('Failed to set hidden attribute on .temp folder');
#end #end
}
}
@@ -20,7 +20,7 @@ class SystemInfo extends FramerateCategory {
public static inline function init() {
#if linux
var process = new HiddenProcess("cat", ["/etc/os-release"]);
if (process.exitCode() != 0) Logs.trace('Unable to grab OS Label', ERROR, RED);
if (process.exitCode() != 0) Logs.error('Unable to grab OS Label');
else {
var osName = "";
var osVersion = "";
@@ -53,7 +53,7 @@ class SystemInfo extends FramerateCategory {
if (lime.system.System.platformLabel != null && lime.system.System.platformLabel != "" && lime.system.System.platformVersion != null && lime.system.System.platformVersion != "")
osInfo = '${lime.system.System.platformLabel.replace(lime.system.System.platformVersion, "").trim()} ${lime.system.System.platformVersion}';
else
Logs.trace('Unable to grab OS Label', ERROR, RED);
Logs.error('Unable to grab OS Label');
#end
try {
@@ -79,7 +79,7 @@ class SystemInfo extends FramerateCategory {
}
#end
} catch (e) {
Logs.trace('Unable to grab CPU Name: $e', ERROR, RED);
Logs.error('Unable to grab CPU Name: $e');
}
@:privateAccess {
@@ -93,24 +93,24 @@ class SystemInfo extends FramerateCategory {
if(openfl.display3D.Context3D.__glMemoryTotalAvailable != -1) {
var vRAMBytes:UInt = cast(flixel.FlxG.stage.context3D.gl.getParameter(openfl.display3D.Context3D.__glMemoryTotalAvailable), UInt);
if (vRAMBytes == 1000 || vRAMBytes == 1 || vRAMBytes <= 0)
Logs.trace('Unable to grab GPU VRAM', ERROR, RED);
Logs.error('Unable to grab GPU VRAM');
else
vRAM = CoolUtil.getSizeString(vRAMBytes * 1000);
}
} else
Logs.trace('Unable to grab GPU Info', ERROR, RED);
Logs.error('Unable to grab GPU Info');
}
#if cpp
totalMem = Std.string(MemoryUtil.getTotalMem() / 1024) + " GB";
#else
Logs.trace('Unable to grab RAM Amount', ERROR, RED);
Logs.error('Unable to grab RAM Amount');
#end
try {
memType = MemoryUtil.getMemType();
} catch (e) {
Logs.trace('Unable to grab RAM Type: $e', ERROR, RED);
Logs.error('Unable to grab RAM Type: $e');
}
formatSysInfo();
}