public void Fatal(string aMsg, bool aLocalOnly) { _log.Fatal(aMsg); if (!aLocalOnly) { LogMessageReceived?.Invoke(this, new ButtplugLogMessageEventArgs(ButtplugLogLevel.Fatal, aMsg)); } }
public void Fatal(string aMsg, bool aLocalOnly) { Console.WriteLine($"[BP-Fatal] {aMsg}"); //_log.Fatal(aMsg); if (!aLocalOnly) { LogMessageReceived?.Invoke(this, new ButtplugLogMessageEventArgs(ButtplugLogLevel.Fatal, aMsg)); } }
/// <summary> /// Informations the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="exception">The exception.</param> public void Info(object message, Exception exception) { var text = (string)message; Debug.WriteLine(text); _log.Info(message, exception); LogMessageReceived?.Invoke(this, new LogMessageReceivedEventEventArgs(text)); }
public void LogMessage(LogLevel level, string application, string message, DateTime timestamp) { if (level <= this.Level) { LogMessageReceived?.Invoke(this, new DebugLogMessageEventArgs { Level = level, Application = application, Message = message, Timestamp = timestamp, TimeFormatting = this.DateTimeFormat }); } }
public static void LogTrace(string msg, [CallerMemberName] string previousMethodName = null, [CallerLineNumber] int callermemberlineNo = 0, [CallerFilePath] string calledFilePath = null) { if (string.IsNullOrEmpty(msg) || string.IsNullOrWhiteSpace(msg)) { return; } LogMessageReceived?.Invoke(null, new LogMessageEventArgs(msg, DateTime.Now, LogEnums.LogLevel.TRACE, previousMethodName, callermemberlineNo, calledFilePath)); }
public void LogMessage(LogLevel level, string application, string message, DateTime timestamp) { if (level >= DiscordClient.config.LogLevel) { LogMessageReceived?.Invoke(this, new DebugLogMessageEventArgs { Level = level, Application = application, Message = message, TimeStamp = timestamp }); } }
private void Connector_RawStringReceived(object sender, RawStringReceivedEventArgs e) { LogMessageReceived?.Invoke(this, new LogMessageEventArgs() { Type = "info", Message = e.Text }); Debug.WriteLine(e.Text); }
public static void Publish(LogMessage logMessage) { if (logMessage == null) { throw new ArgumentNullException(nameof(logMessage)); } LogMessageReceived?.Invoke(null, new LogReceivedEventArgs(logMessage)); }
public static void LogException(Exception e, [CallerMemberName] string previousMethodName = null, [CallerLineNumber] int callermemberlineNo = 0, [CallerFilePath] string calledFilePath = null) { if (e == null) { return; } LogMessageReceived?.Invoke(null, new LogMessageEventArgs(e.ToString(), DateTime.Now, LogEnums.LogLevel.EXCEPTION, previousMethodName, callermemberlineNo, calledFilePath)); OnExceptionOccured?.Invoke(null, new OnExceptionMessageEventArgs(e, DateTime.Now, previousMethodName, callermemberlineNo, calledFilePath)); }
public void Trace(string?message, [CallerMemberName] string?previousMethodName = null, [CallerLineNumber] int callermemberlineNo = 0, [CallerFilePath] string?calledFilePath = null) { if (string.IsNullOrEmpty(message)) { return; } LogMessageReceived?.Invoke(this, new LogMessageEventArgs(LogIdentifier, message, DateTime.Now, LogLevels.Trace, previousMethodName, callermemberlineNo, calledFilePath)); }
private void HandleLogMessage(SerialMessage message) { if (message.Parameters.Length < 1) { throw new SerialMessageMalformedException($"Log message has the incorrect number of params; expected at least 1, was {message.Parameters.Length}", message); } LogMessageReceived?.Invoke(this, new LogMessageEventArgs() { Type = message.Parameters[0], Message = string.Join(' ', message.Parameters.Skip(1).ToArray()) }); }
public void WithColor(string?message, ConsoleColor color = ConsoleColor.Cyan, [CallerMemberName] string?previousMethodName = null, [CallerLineNumber] int callermemberlineNo = 0, [CallerFilePath] string?calledFilePath = null) { if (string.IsNullOrEmpty(message)) { return; } LogMessageReceived?.Invoke(this, new LogMessageEventArgs(LogIdentifier, message, DateTime.Now, LogLevels.Custom, previousMethodName, callermemberlineNo, calledFilePath)); OnColoredReceived?.Invoke(this, new WithColorEventArgs(LogIdentifier, DateTime.Now, message, color, previousMethodName, callermemberlineNo, calledFilePath)); }
public void Exception(Exception?exception, [CallerMemberName] string?previousMethodName = null, [CallerLineNumber] int callermemberlineNo = 0, [CallerFilePath] string?calledFilePath = null) { if (exception == null || exception.GetBaseException() == null) { return; } LogMessageReceived?.Invoke(this, new LogMessageEventArgs(LogIdentifier, exception.ToString(), DateTime.Now, LogLevels.Exception, previousMethodName, callermemberlineNo, calledFilePath)); OnExceptionReceived?.Invoke(this, new OnExceptionMessageEventArgs(LogIdentifier, exception, DateTime.Now, previousMethodName, callermemberlineNo, calledFilePath)); }
public static void EmitError(string message, IToken token) { HasErrors = true; string output = $"Error on line {token.Line} in {token.InputStream.SourceName}:\n{message}"; LogMessageReceived?.Invoke(output, LogType.Error); if (ThrowExceptions) { throw new Exception(message); } }
private void ProcessLog(LogEntry entry) { var has = m_CollapsedLogEntriesMap.TryGetValue(entry, out int index); //s_Timestamps.Add($"[{DateTime.Now.Ticks}]"); var type = entry.logType; if (has) { m_CollapsedLogEntries[index].count++; LogEntry.Release(entry); //s_CollapsedTimestampsIndices[index] = s_Timestamps.Count - 1; } else { index = m_CollapsedLogEntries.Count; m_CollapsedLogEntries.Add(entry); m_CollapsedLogEntriesMap[entry] = index; //s_CollapsedTimestampsIndices.Add(index); } if (!(HasLogFlag(ELogTypeFlag.Collapsed) && has)) { if (HasLogFlag(ELogTypeFlag.Error) || HasLogFlag(ELogTypeFlag.Warning) || HasLogFlag(ELogTypeFlag.Info)) { m_LogEntryIndicesToShow.Add(index); } } if (type == UnityEngine.LogType.Error) { m_ErrorCount++; } if (type == UnityEngine.LogType.Warning) { m_WarningCount++; } if (type == UnityEngine.LogType.Log) { m_InfoCount++; } m_UnCollapsedLogEntryIndices.Add(index); LogMessageReceived?.Invoke(has, index, m_InfoCount, m_WarningCount, m_ErrorCount); }
/// <summary> /// Logs a message to this DebugLogger /// </summary> /// <param name="level">Log level (severity of this message)</param> /// <param name="application">What this message applies to</param> /// <param name="message">Message to log</param> /// <param name="timestamp">When this message was sent</param> /// <param name="exception">The exception that occurred</param> public void LogMessage(LogLevel level, string application, string message, DateTime timestamp, Exception exception = null) { if (level <= this.Level) { //message = message.Replace("\r", ""); //var lines = new[] { message }; //if (message.Contains('\n')) // lines = message.Split('\n'); //foreach (var line in lines) LogMessageReceived?.Invoke(this, new DebugLogMessageEventArgs { Level = level, Application = application, Message = message, Exception = exception, Timestamp = timestamp, TimeFormatting = this.DateTimeFormat }); } }
private void LogMessageHandler([NotNull] object aObject, [NotNull] ButtplugLogMessageEventArgs aMsg) { if (aObject == null) { throw new ArgumentNullException(nameof(aObject)); } if (aMsg == null) { throw new ArgumentNullException(nameof(aMsg)); } if (aMsg.LogMessage.LogLevel <= Level) { LogMessageReceived?.Invoke(aObject, aMsg); } }
internal void ClearLog() { for (int i = 0; i < m_CollapsedLogEntries.Count; i++) { var entry = m_CollapsedLogEntries[i]; LogEntry.Release(entry); } m_CollapsedLogEntries.Clear(); m_CollapsedLogEntriesMap.Clear(); m_UnCollapsedLogEntryIndices.Clear(); m_LogEntryIndicesToShow.Clear(); m_Timestamps.Clear(); m_CollapsedTimestampsIndices.Clear(); m_Set.Clear(); m_InfoCount = m_WarningCount = m_ErrorCount = 0; LogMessageReceived?.Invoke(false, -1, m_InfoCount, m_WarningCount, m_ErrorCount); }
public void ReceiveLogMessage(object sender, LogMessage message) { LogMessageReceived?.Invoke(sender, message); }
private void OnLogMessageReceived(LogMessage e) { LogMessageReceived?.Invoke(this, e); }
public static void EmitMessage(string message, IToken token) { string output = $"Message on line {token.Line} in {token.InputStream.SourceName}:\n{message}"; LogMessageReceived?.Invoke(output, LogType.Log); }
internal void LogMessage(string message) { LogMessageReceived?.Invoke(message); }
private void OnLogMessageReceived(string condition, string stacktrace, LogType type) => LogMessageReceived?.Invoke(condition, stacktrace, type);
private void FireLogMessageReceived(string message, LogType logType) { lock (_lock) { LogMessageReceived.Invoke(message, logType); } }
protected virtual void OnLogMessageReceived(LogMessage e) { LogMessageReceived?.Invoke(this, e); }
public void Log(LogLevels level, string correlationId, string tag, string method, string message, LogTypes type, Dictionary <string, string> properties = null, double duration = 0) { // Convert to a dictionary LogMessageReceived?.Invoke(this, new LogMessage(level, correlationId, tag, method, message, type, properties, duration)); }