mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
feat: add verbose flag for injector
This commit is contained in:
parent
2dabab812d
commit
b083ea65c0
1 changed files with 13 additions and 8 deletions
|
|
@ -39,7 +39,6 @@ namespace Dalamud.Injector
|
||||||
public static void Main(int argc, IntPtr argvPtr)
|
public static void Main(int argc, IntPtr argvPtr)
|
||||||
{
|
{
|
||||||
List<string> args = new(argc);
|
List<string> args = new(argc);
|
||||||
Init(args);
|
|
||||||
|
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
|
|
@ -48,6 +47,9 @@ namespace Dalamud.Injector
|
||||||
args.Add(Marshal.PtrToStringUni(argv[i]));
|
args.Add(Marshal.PtrToStringUni(argv[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Init(args);
|
||||||
|
args.Remove("-v"); // Remove "verbose" flag
|
||||||
|
|
||||||
if (args.Count >= 2 && args[1].ToLowerInvariant() == "launch-test")
|
if (args.Count >= 2 && args[1].ToLowerInvariant() == "launch-test")
|
||||||
{
|
{
|
||||||
Environment.Exit(ProcessLaunchTestCommand(args));
|
Environment.Exit(ProcessLaunchTestCommand(args));
|
||||||
|
|
@ -130,8 +132,8 @@ namespace Dalamud.Injector
|
||||||
|
|
||||||
private static void Init(List<string> args)
|
private static void Init(List<string> args)
|
||||||
{
|
{
|
||||||
|
InitLogging(args.Any(x => x == "-v"));
|
||||||
InitUnhandledException(args);
|
InitUnhandledException(args);
|
||||||
InitLogging();
|
|
||||||
|
|
||||||
var cwd = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
|
var cwd = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
|
||||||
if (cwd.FullName != Directory.GetCurrentDirectory())
|
if (cwd.FullName != Directory.GetCurrentDirectory())
|
||||||
|
|
@ -186,16 +188,17 @@ namespace Dalamud.Injector
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InitLogging()
|
private static void InitLogging(bool verbose)
|
||||||
{
|
{
|
||||||
var levelSwitch = new LoggingLevelSwitch();
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
levelSwitch.MinimumLevel = LogEventLevel.Verbose;
|
verbose = true;
|
||||||
#else
|
|
||||||
levelSwitch.MinimumLevel = LogEventLevel.Information;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
var levelSwitch = new LoggingLevelSwitch
|
||||||
|
{
|
||||||
|
MinimumLevel = verbose ? LogEventLevel.Verbose : LogEventLevel.Information,
|
||||||
|
};
|
||||||
|
|
||||||
var logPath = GetLogPath("dalamud.injector");
|
var logPath = GetLogPath("dalamud.injector");
|
||||||
|
|
||||||
Environment.SetEnvironmentVariable("DALAMUD_BOOT_LOGFILE", GetLogPath("dalamud.boot"));
|
Environment.SetEnvironmentVariable("DALAMUD_BOOT_LOGFILE", GetLogPath("dalamud.boot"));
|
||||||
|
|
@ -365,6 +368,8 @@ namespace Dalamud.Injector
|
||||||
Console.WriteLine(" [--dalamud-asset-directory=path] [--dalamud-delay-initialize=0(ms)]");
|
Console.WriteLine(" [--dalamud-asset-directory=path] [--dalamud-delay-initialize=0(ms)]");
|
||||||
Console.WriteLine(" [--dalamud-client-language=0-3|j(apanese)|e(nglish)|d|g(erman)|f(rench)]");
|
Console.WriteLine(" [--dalamud-client-language=0-3|j(apanese)|e(nglish)|d|g(erman)|f(rench)]");
|
||||||
|
|
||||||
|
Console.WriteLine("Verbose logging: [-v]");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue