mirror of https://github.com/2dust/v2rayN
Gui's log can be turned off
parent
b1a82d95c2
commit
6ee8f03ec0
|
@ -42,10 +42,11 @@ namespace v2rayN
|
||||||
Global.processJob = new Job();
|
Global.processJob = new Job();
|
||||||
|
|
||||||
Logging.Setup();
|
Logging.Setup();
|
||||||
|
Init();
|
||||||
|
Logging.LoggingEnabled(_config.guiItem.enableLog);
|
||||||
Utils.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
|
Utils.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
|
||||||
Logging.ClearLogs();
|
Logging.ClearLogs();
|
||||||
|
|
||||||
Init();
|
|
||||||
|
|
||||||
Thread.CurrentThread.CurrentUICulture = new(_config.uiItem.currentLanguage);
|
Thread.CurrentThread.CurrentUICulture = new(_config.uiItem.currentLanguage);
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,8 @@ namespace v2rayN.Mode
|
||||||
public int trayMenuServersLimit { get; set; } = 20;
|
public int trayMenuServersLimit { get; set; } = 20;
|
||||||
|
|
||||||
public bool enableHWA { get; set; } = false;
|
public bool enableHWA { get; set; } = false;
|
||||||
|
|
||||||
|
public bool enableLog { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
|
@ -17,6 +17,13 @@ namespace v2rayN.Tool
|
||||||
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
|
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
|
||||||
LogManager.Configuration = config;
|
LogManager.Configuration = config;
|
||||||
}
|
}
|
||||||
|
public static void LoggingEnabled(bool enable)
|
||||||
|
{
|
||||||
|
if (!enable)
|
||||||
|
{
|
||||||
|
LogManager.SuspendLogging();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void ClearLogs()
|
public static void ClearLogs()
|
||||||
{
|
{
|
||||||
|
|
|
@ -780,7 +780,7 @@ namespace v2rayN
|
||||||
task.Settings.RunOnlyIfIdle = false;
|
task.Settings.RunOnlyIfIdle = false;
|
||||||
task.Settings.IdleSettings.StopOnIdleEnd = false;
|
task.Settings.IdleSettings.StopOnIdleEnd = false;
|
||||||
task.Settings.ExecutionTimeLimit = TimeSpan.Zero;
|
task.Settings.ExecutionTimeLimit = TimeSpan.Zero;
|
||||||
task.Triggers.Add(new LogonTrigger { UserId = logonUser, Delay = TimeSpan.FromMinutes(1) });
|
task.Triggers.Add(new LogonTrigger { UserId = logonUser, Delay = TimeSpan.FromSeconds(10) });
|
||||||
task.Principal.RunLevel = TaskRunLevel.Highest;
|
task.Principal.RunLevel = TaskRunLevel.Highest;
|
||||||
task.Actions.Add(new ExecAction(deamonFileName));
|
task.Actions.Add(new ExecAction(deamonFileName));
|
||||||
|
|
||||||
|
@ -1151,11 +1151,16 @@ namespace v2rayN
|
||||||
#region Log
|
#region Log
|
||||||
|
|
||||||
public static void SaveLog(string strContent)
|
public static void SaveLog(string strContent)
|
||||||
|
{
|
||||||
|
if (LogManager.IsLoggingEnabled())
|
||||||
{
|
{
|
||||||
var logger = LogManager.GetLogger("Log1");
|
var logger = LogManager.GetLogger("Log1");
|
||||||
logger.Info(strContent);
|
logger.Info(strContent);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static void SaveLog(string strTitle, Exception ex)
|
public static void SaveLog(string strTitle, Exception ex)
|
||||||
|
{
|
||||||
|
if (LogManager.IsLoggingEnabled())
|
||||||
{
|
{
|
||||||
var logger = LogManager.GetLogger("Log2");
|
var logger = LogManager.GetLogger("Log2");
|
||||||
logger.Debug($"{strTitle},{ex.Message}");
|
logger.Debug($"{strTitle},{ex.Message}");
|
||||||
|
@ -1165,6 +1170,7 @@ namespace v2rayN
|
||||||
logger.Error(ex.InnerException);
|
logger.Error(ex.InnerException);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue