private void Log(LogLevel level, string message, Exception ex) { Contract.Requires(message != null); lock (sync) { NewLogEntry?.Invoke(level, message, ex); } }
/// <summary> /// Logs the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="type">The type.</param> public void Log(string message, MessageTypeEnum type) { MessageReceivedEventArgs msg = new MessageReceivedEventArgs(message, type); MessageReceived.Invoke(this, msg); this.logs.Add(msg); string[] args = { message, type.ToString() }; NewLogEntry?.Invoke(this, new CommandReceivedEventArgs((int)CommandEnum.LogCommand, args, null)); }
/// <summary> /// Logs the specified message. /// </summary> /// <param name="msg">The message.</param> /// <param name="msg_type">The type.</param> public void Log(string msg, MessageTypeEnum msg_type) { //creating the new message MessageReceivedEventArgs new_msg = new MessageReceivedEventArgs(msg, msg_type); MessageReceived.Invoke(this, new_msg); //adding a new message this.logs.Add(new_msg); string[] args = { msg, msg_type.ToString() }; //invoking log NewLogEntry?.Invoke(this, new CommandReceivedEventArgs((int)CommandEnum.LogCommand, args, null)); }
protected virtual void OnNewLogEntry(NewLogEntryEventArgs e) { NewLogEntry?.Invoke(this, e); }
private void OnNewEntry(object sender, BotLoggerEntry entry) => NewLogEntry?.Invoke(this, entry);
protected virtual void OnNewLogEntry(ILogEntry logEntry) { NewLogEntry?.Invoke(logEntry); }
public void WriteLog(string log) => NewLogEntry?.Invoke(log, EventArgs.Empty);
private void OnLog(string v) { NewLogEntry?.Invoke(v); }