private static void UnityLogFormat(LogType type, LogOption option, Object context, string tag, string format, params object[] args) { try { if (args.Length > 0) { Debug.LogFormat(type, option, context, string.Concat(tag, ":", format), args); } else { if (type == LogType.Log) { Debug.Log(string.Concat(tag, ":", format), context); } else if (type == LogType.Warning) { Debug.LogWarning(string.Concat(tag, ":", format), context); } else if (type == LogType.Error) { Debug.LogError(string.Concat(tag, ":", format), context); } } } catch (Exception ex) { DebugUtility.LogError(LoggerTags.Engine, "The formatting-string or argument is abnormal."); DebugUtility.LogException(ex); } }
public static void DelLogByDay(int daysBefore, LogOption option) { if (daysBefore <= 0) { return; } string from = DateTime.Now.AddDays(-daysBefore).ToString("yyyyMMdd"); string to = DateTime.Now.ToString("yyyyMMdd"); string dir = Application.StartupPath + "\\Log\\"; string dic = null; foreach (string d in Directory.GetDirectories(dir)) { dic = Path.GetFileName(d); if (int.Parse(dic) >= int.Parse(from) && int.Parse(dic) < int.Parse(to)) { if (option == LogOption.All) { Directory.Delete(d, true); } else if (option == LogOption.Application) { File.Delete(Path.Combine(d, "App.log")); } else { File.Delete(Path.Combine(d, "Package.log")); } } } }
static int LogTypeOptionsToLogMessageFlags(LogType logType, LogOption logOptions) { LogMessageFlags logMessageFlags; if (logType == LogType.Log) // LogType::Log { logMessageFlags = LogMessageFlags.ScriptingLog; } else if (logType == LogType.Warning) // LogType::Warning { logMessageFlags = LogMessageFlags.ScriptingWarning; } else if (logType == LogType.Error) // LogType::Error { logMessageFlags = LogMessageFlags.ScriptingError; } else if (logType == LogType.Exception) // LogType::Exception { logMessageFlags = LogMessageFlags.ScriptingException; } else { logMessageFlags = LogMessageFlags.ScriptingAssertion; } if (logOptions == LogOption.NoStacktrace) { logMessageFlags |= LogMessageFlags.DontExtractStacktrace; } return((int)logMessageFlags); }
public static void Unity(string msg, bool stackTrace = true, Level level = Level.INFO) { if ((int)level < MIN_LEVEL) { return; } #if UNITY_EDITOR #else if ((int)level < BUILD_MIN) { return; } #endif msg = $"Frame {ETime.FrameNumber}: {msg}"; LogOption lo = stackTrace ? LogOption.None : LogOption.NoStacktrace; LogType unityLT = LogType.Log; file.WriteLine(msg); if (level == Level.WARNING) { unityLT = LogType.Warning; } if (level == Level.ERROR) { unityLT = LogType.Error; Debug.LogError(msg); } else { Debug.LogFormat(unityLT, lo, null, msg.Replace("{", "{{").Replace("}", "}}")); } }
public static void LogFormat(LogType logType, LogOption logOptions, Object context, string format, params object[] args) { if (isDebugBuild) { Debug.LogFormat(logType, logOptions, context, logTag + ": " + format, args); } }
public FilesMiddleware(RequestDelegate next, IOptionsMonitor <LogOption> optionsMonitor, IOptionsSnapshot <LogOption> optionsSnapshot, IOptionsSnapshot <UserSecretsOptions> userSecretsOptions) { Console.WriteLine($"{nameof(FilesMiddleware)} reached"); Console.WriteLine($"User Secrets: Username {userSecretsOptions.Value.Username} - Password {userSecretsOptions.Value.Password}"); _next = next; _options = optionsSnapshot.Value; optionsMonitor.OnChange(ChangeListner); //this is invoked when we save appsettings.json }
public HomeController(IOptionsSnapshot <LogOption> optionsSnapshot, ILoggerFactory loggerFactory, INotifier notifier) { Console.WriteLine($"{nameof(HomeController)} reached"); _option = optionsSnapshot.Value; _log = loggerFactory.CreateLogger(typeof(HomeController)); _notifier = notifier; }
public static void LogFormat(LogType logType, LogOption logOptions, Object context, string format, params object[] args) { if (LogSwitch == false) { return; } UnityEngine.Debug.LogFormat(logType, logOptions, context, format, args); }
public void Log(string message, LogType logType, LogOption logOption, Object context = null) { var fullMessage = _richTextFactory .UnstyledText(TitleBacked) .UnstyledText(message).ToString(); _richTextFactory.Clear(); Debug.LogFormat(logType, logOption, context, fullMessage); }
protected override void OnClosing(CancelEventArgs e) { user.earned += dayEarned; user.spent += daySpent; user.IsLogged = false; currentLog.SingedOut = DateTime.Now; currentLog.Earned = dayEarned; currentLog.Spent = daySpent; LogOption.AddLogEntity(ref currentLog); UserOption.updateUser(ref user); base.OnClosing(e); }
public static void LogSticky(string message, string file, LogType logType, LogOption logOptions, int instanceId) { int mode = LogTypeOptionsToLogMessageFlags(logType, logOptions) | (int)LogMessageFlags.StickyLog; LogEntries.AddMessageWithDoubleClickCallback(new LogEntry { message = message, file = file, mode = mode, identifier = k_GTFLogIdentifier, instanceID = instanceId, }); }
public static void LogFormat(LogType logType, LogOption logOptions, Object context, string format, params object[] args) { var l = unityLogger.logHandler as DebugLogHandler; if (l == null) { unityLogger.LogFormat(logType, context, format, args); } else { l.LogFormat(logType, logOptions, context, format, args); } }
public static void LogFormat(LogType logType, LogOption logOptions, Object context, string format, params object[] args) { DebugLogHandler debugLogHandler = Debug.unityLogger.logHandler as DebugLogHandler; bool flag = debugLogHandler == null; if (flag) { Debug.unityLogger.LogFormat(logType, context, format, args); } else { debugLogHandler.LogFormat(logType, logOptions, context, format, args); } }
public static void LogFormat(LogType logType, LogOption logOptions, UnityEngine.Object context, string format, DebugTag debugTag = null, params object[] args) { if (debugTag != null && !HasTag(debugTag)) { return; } if (!Settings.LoggerData.LogType.HasFlag(logType)) { return; } UnityEngine.LogType convertLogType = (UnityEngine.LogType)(int) Mathf.Log((int)logType, 2); UnityEngine.Debug.LogFormat(convertLogType, logOptions, context, format, args); }
public void SendtoLog(string str, LogOption option) { if (this.richTextBox1.InvokeRequired) { LogMessageDelegate d = new LogMessageDelegate(SendtoLog); this.Invoke(d); } else { richTextBox1.SelectionCharOffset = 2; richTextBox1.SelectedText = string.Empty; richTextBox1.SelectionStart = richTextBox1.TextLength; switch (option) { case LogOption.Normal: richTextBox1.SelectionColor = Color.White; richTextBox1.SelectionAlignment = HorizontalAlignment.Left; break; case LogOption.System: richTextBox1.SelectionColor = Color.Yellow; richTextBox1.SelectionAlignment = HorizontalAlignment.Left; break; case LogOption.Error: richTextBox1.SelectionColor = Color.FromArgb(0xd9, 0x2b, 0x2b); richTextBox1.SelectionAlignment = HorizontalAlignment.Left; break; case LogOption.Equation: richTextBox1.SelectionColor = Color.PeachPuff; richTextBox1.SelectionAlignment = HorizontalAlignment.Left; break; case LogOption.Result: richTextBox1.SelectionColor = Color.LightBlue; richTextBox1.SelectionAlignment = HorizontalAlignment.Left; break; } richTextBox1.AppendText(str); richTextBox1.ScrollToCaret(); } }
public static void LogFormat(LogType logType , LogOption logOptions , Object context , string format , params object[] args) { bool mutingThisLog = !Instance.LogEnabled(); if (logType != LogType.Log) { if (!Instance.AllowWarningAndErrorMuting) { mutingThisLog = false; } } if (mutingThisLog) { return; } Debug.LogFormat(logType, logOptions, context, Instance.m_ColorString + format, args); }
private void ChangeListner(LogOption arg1, string arg2) { Console.WriteLine($"NotifyChange :{arg1.Default}:{arg2?.ToString()}"); }
public static void LogSticky(LogType logType, LogOption logOptions, string message) { LogSticky(logType, logOptions, message, string.Empty, 0); }
public static void LogFormat(LogType logType, LogOption logOptions, Object context, string format, params object[] args) { Debug.LogFormat(logType, logOptions, context, format, args); }
public LogData(DateTime t, LogOption o, LogSource s, string d) { time = t; option = o; source = s; data = d; }
[Conditional("DUMMY")] public static void LogFormat(LogType logType, LogOption logOptions, Object context, string format, params object[] args) { }
public LogContextProperty(LogOption logOption) { Log = logOption; }
public static void LogSticky(LogType logType, LogOption logOptions, string message, string file, int instanceId) { ConsoleWindowBridge.LogSticky(message, file, logType, logOptions, instanceId); }
public void LogFormat(LogType logType, LogOption logOptions, Object context, string format, params object[] args) { DebugLogHandler.Internal_Log(logType, logOptions, string.Format(format, args), context); }
public void Log(string message, LogOption logOption) => Log(message, LogType.Log, logOption);
internal static extern void Internal_Log(LogType level, LogOption options, string msg, Object obj);
[ThreadAndSerializationSafe] // 0x00000001800D4E50-0x00000001800D4E60 internal static void Internal_Log(LogType level, LogOption options, string msg, Object obj) { } // 0x00000001809669B0-0x0000000180966A10
internal static extern void LogSticky(int identifier, LogType logType, LogOption logOptions, string message, Object context = null);
public LogbookAttribute(LogOption logOption) : base("LogbookAttribute") { m_LogOption = logOption; }
// allows messages of selected type to show in log file static public void SetOption(LogOption o) { option |= o; }