Cleaned up Warning And Error Code
This commit is contained in:
@@ -50,7 +50,7 @@ class ModsFolder {
|
||||
public static function init() {
|
||||
if(!getModsList().contains(Options.lastLoadedMod)) {
|
||||
Options.lastLoadedMod = null;
|
||||
Logs.trace("Mod not found in mods list, switching to base game!", WARNING, YELLOW);
|
||||
Logs.warn("Mod not found in mods list, switching to base game!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class Chart {
|
||||
try {
|
||||
data = Json.parse(Assets.getText(path)).events;
|
||||
} catch(e) {
|
||||
Logs.trace('Failed to load song event data for ${songName} ($path): ${Std.string(e)}', ERROR);
|
||||
Logs.error('Failed to load song event data for ${songName} ($path): ${Std.string(e)}');
|
||||
}
|
||||
}
|
||||
return data;
|
||||
@@ -44,7 +44,7 @@ class Chart {
|
||||
try {
|
||||
data = Json.parse(Assets.getText(path));
|
||||
} catch(e) {
|
||||
Logs.trace('Failed to load song metadata for ${songName} ($path): ${Std.string(e)}', ERROR);
|
||||
Logs.error('Failed to load song metadata for ${songName} ($path): ${Std.string(e)}');
|
||||
}
|
||||
if (data != null) break;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class Chart {
|
||||
|
||||
var valid:Bool = true;
|
||||
if (!Assets.exists(chartPath)) {
|
||||
Logs.trace('Chart for song ${songName} ($difficulty) at "$chartPath" was not found.', ERROR, RED);
|
||||
Logs.error('Chart for song ${songName} ($difficulty) at "$chartPath" was not found.');
|
||||
valid = false;
|
||||
}
|
||||
var data:Dynamic = null;
|
||||
@@ -113,7 +113,7 @@ class Chart {
|
||||
if (valid)
|
||||
data = Json.parse(Assets.getText(chartPath));
|
||||
} catch(e) {
|
||||
Logs.trace('Could not parse chart for song ${songName} ($difficulty): ${Std.string(e)}', ERROR, RED);
|
||||
Logs.error('Could not parse chart for song ${songName} ($difficulty): ${Std.string(e)}');
|
||||
}
|
||||
|
||||
if (data != null) {
|
||||
|
||||
@@ -132,10 +132,10 @@ class FNFLegacyParser {
|
||||
if ((swagSection.mustHitSection && strumLine.type == OPPONENT) ||
|
||||
(!swagSection.mustHitSection && strumLine.type == PLAYER))
|
||||
sectionNote[1] += 4;
|
||||
swagSection.sectionNotes.push(note);
|
||||
swagSection.sectionNotes.push(note);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {song: base};
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class PsychParser {
|
||||
for (note in strumLine.notes) {
|
||||
var section:Int = Math.floor(Conductor.getStepForTime(note.time) / Conductor.getMeasureLength());
|
||||
var swagSection:SwagSection = base.notes[section];
|
||||
|
||||
|
||||
if (section >= 0 && section < base.notes.length) {
|
||||
var sectionNote:Array<Dynamic> = [
|
||||
note.time, // TIME
|
||||
@@ -44,10 +44,10 @@ class PsychParser {
|
||||
if ((swagSection.mustHitSection && strumLine.type == OPPONENT) ||
|
||||
(!swagSection.mustHitSection && strumLine.type == PLAYER))
|
||||
sectionNote[1] += 4;
|
||||
swagSection.sectionNotes.push(sectionNote);
|
||||
swagSection.sectionNotes.push(sectionNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var groupedEvents:Array<Array<ChartEvent>> = [];
|
||||
var __last:Array<ChartEvent> = null;
|
||||
var __lastTime:Float = Math.NaN;
|
||||
@@ -91,7 +91,7 @@ class PsychParser {
|
||||
FlxMath.roundDecimal(event.params[1]/chart.scrollSpeed, 2), // SCROLL SPEED MULTIPLER
|
||||
FlxMath.roundDecimal( // TIME
|
||||
event.params[0] ? // IS TWEENED?
|
||||
(Conductor.getTimeForStep(eventStep+event.params[2]) - Conductor.getTimeForStep(eventStep))/1000
|
||||
(Conductor.getTimeForStep(eventStep+event.params[2]) - Conductor.getTimeForStep(eventStep))/1000
|
||||
: 0, 2)
|
||||
]);
|
||||
default:
|
||||
@@ -106,7 +106,7 @@ class PsychParser {
|
||||
|
||||
for (psychEvent in psychEvents)
|
||||
for (i in 1...3) // Turn both vals into strings
|
||||
if (!(psychEvent[i] is String))
|
||||
if (!(psychEvent[i] is String))
|
||||
psychEvent[i] = Std.string(psychEvent[i]);
|
||||
|
||||
base.events.push([events[0].time, psychEvents]);
|
||||
|
||||
@@ -28,7 +28,7 @@ class HScript extends Script {
|
||||
|
||||
try {
|
||||
if(Assets.exists(rawPath)) code = Assets.getText(rawPath);
|
||||
} catch(e) Logs.trace('Error while reading $path: ${Std.string(e)}', ERROR);
|
||||
} catch(e) Logs.error('Error while reading $path: ${Std.string(e)}');
|
||||
|
||||
parser = initParser();
|
||||
//folderlessPath = Path.directory(path);
|
||||
|
||||
@@ -153,7 +153,7 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
var arr = Assets.getText(path).split("________PACKSEP________");
|
||||
fromString(arr[1], arr[0]);
|
||||
case "lua":
|
||||
Logs.trace("Lua is not supported in this engine. Use HScript instead.", ERROR);
|
||||
Logs.error("Lua is not supported in this engine. Use HScript instead.");
|
||||
new DummyScript(path);
|
||||
default:
|
||||
new DummyScript(path);
|
||||
@@ -172,7 +172,7 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
case "hx" | "hscript" | "hsc" | "hxs":
|
||||
new HScript(path).loadFromString(code);
|
||||
case "lua":
|
||||
Logs.trace("Lua is not supported in this engine. Use HScript instead.", ERROR);
|
||||
Logs.error("Lua is not supported in this engine. Use HScript instead.");
|
||||
new DummyScript(path).loadFromString(code);
|
||||
default:
|
||||
new DummyScript(path).loadFromString(code);
|
||||
|
||||
@@ -30,7 +30,7 @@ class CustomShader extends FunkinShader {
|
||||
path = fragShaderPath+vertShaderPath;
|
||||
|
||||
if (fragCode == null && vertCode == null)
|
||||
Logs.trace('Shader "$name" couldn\'t be found.', ERROR);
|
||||
Logs.error('Shader "$name" couldn\'t be found.');
|
||||
|
||||
super(fragCode, vertCode, glslVersion);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class CoolUtil
|
||||
try {
|
||||
sys.FileSystem.deleteFile(delete + "/" + file);
|
||||
} catch(e) {
|
||||
Logs.trace("Could not delete " + delete + "/" + file, WARNING);
|
||||
Logs.warn("Could not delete " + delete + "/" + file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ class CoolUtil
|
||||
else sys.io.File.saveContent(path, content);
|
||||
} catch(e) {
|
||||
var errMsg:String = 'Error while trying to save the file: ${Std.string(e).replace('\n', ' ')}';
|
||||
Logs.traceColored([Logs.logText(errMsg, RED)], ERROR);
|
||||
Logs.error(errMsg);
|
||||
if(showErrorBox) funkin.backend.utils.NativeAPI.showMessageBox("Codename Engine Warning", errMsg, MSG_WARNING);
|
||||
}
|
||||
#end
|
||||
|
||||
@@ -79,7 +79,7 @@ class DiscordUtil
|
||||
try
|
||||
config = Json.parse(Assets.getText(jsonPath))
|
||||
catch (e)
|
||||
Logs.trace('Couldn\'t load Discord RPC configuration: ${e.toString()}', ERROR);
|
||||
Logs.error('Couldn\'t load Discord RPC configuration: ${e.toString()}');
|
||||
}
|
||||
|
||||
if (config == null)
|
||||
@@ -344,7 +344,7 @@ class DiscordUtil
|
||||
Logs.traceColored([
|
||||
Logs.logText("[Discord] ", BLUE),
|
||||
Logs.logText("Someone has just requested to join", YELLOW)
|
||||
], WARNING);
|
||||
], INFO);
|
||||
|
||||
var req:DUser = DUser.initRaw(request);
|
||||
call("onJoinRequest", [req]);
|
||||
|
||||
@@ -43,7 +43,7 @@ class NdllUtil {
|
||||
//return Reflect.callMethod(null, func, a); // wouldnt work for some reason, maybe cause like c++ functions doesnt have reflection enabled
|
||||
});
|
||||
#else
|
||||
Logs.trace('NDLLs are not supported on this platform.', WARNING);
|
||||
Logs.warn('NDLLs are not supported on this platform.');
|
||||
return noop;
|
||||
#end
|
||||
}
|
||||
@@ -58,20 +58,20 @@ class NdllUtil {
|
||||
public static function getFunctionFromPath(ndll:String, name:String, args:Int):Dynamic {
|
||||
#if NDLLS_SUPPORTED
|
||||
if (!Assets.exists(ndll)) {
|
||||
Logs.trace('Couldn\'t find ndll at ${ndll}.', WARNING);
|
||||
Logs.warn('Couldn\'t find ndll at ${ndll}.');
|
||||
return noop;
|
||||
}
|
||||
var func = lime.system.CFFI.load(Assets.getPath(ndll), name, args);
|
||||
|
||||
if (func == null) {
|
||||
Logs.trace('Method ${name} in ndll ${ndll} with ${args} args was not found.', ERROR);
|
||||
Logs.error('Method ${name} in ndll ${ndll} with ${args} args was not found.');
|
||||
return noop;
|
||||
}
|
||||
return func;
|
||||
#else
|
||||
Logs.trace('NDLLs are not supported on this platform.', WARNING);
|
||||
#end
|
||||
Logs.warn('NDLLs are not supported on this platform.');
|
||||
return noop;
|
||||
#end
|
||||
}
|
||||
|
||||
@:dox(hide) @:noCompletion static function noop() {}
|
||||
|
||||
@@ -123,13 +123,12 @@ class TranslationUtil
|
||||
var xml:Access = null;
|
||||
try xml = new Access(Xml.parse(Assets.getText('$mainPath/$file')))
|
||||
catch(e) {
|
||||
var msg:String = 'Error while parsing $file: ${Std.string(e)}';
|
||||
FlxG.log.error(msg);
|
||||
throw new Exception(msg);
|
||||
Logs.error('Error while parsing $file: ${Std.string(e)}');
|
||||
return [];
|
||||
}
|
||||
if (xml == null) return [];
|
||||
if (!xml.hasNode.translations) {
|
||||
Logs.trace("A translation xml file requires a translations root element.", WARNING, YELLOW);
|
||||
Logs.warn("A translation xml file requires a translations root element.");
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -138,7 +137,7 @@ class TranslationUtil
|
||||
switch(node.name) {
|
||||
case "trans":
|
||||
if (!node.has.id) {
|
||||
FlxG.log.warn("A translation node requires an ID attribute.");
|
||||
Logs.warn("A translation node requires an ID attribute.");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class XMLUtil {
|
||||
*/
|
||||
public static function applyXMLProperty(object:Dynamic, property:Access):ErrorCode {
|
||||
if (!property.has.name || !property.has.type || !property.has.value) {
|
||||
Logs.trace('Failed to apply XML property: XML Element is missing name, type, or value attributes.', WARNING);
|
||||
Logs.warn('Failed to apply XML property: XML Element is missing name, type, or value attributes.');
|
||||
return MISSING_PROPERTY;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class XMLUtil {
|
||||
if(isPath) {
|
||||
str += ' (Path: ${property.att.name})';
|
||||
}
|
||||
Logs.trace(str, WARNING);
|
||||
Logs.warn(str);
|
||||
return REFLECT_ERROR;
|
||||
}
|
||||
return OK;
|
||||
|
||||
Reference in New Issue
Block a user