public void WriteLine(LogKind logKind, string text) { Logger.Write(logKind, Prefix); Logger.WriteLine(logKind, text); isNewLine = true; }
public LogTemporary(LogKind logKind, SockObj sockObj, int messageNo, String detailInfomation) { LogKind = logKind; SockObj = sockObj; MessageNo = messageNo; DetailInfomation = detailInfomation; }
public void Write(LogKind logKind, string text) { capturedOutput.Add(new OutputLine { Kind = logKind, Text = text }); }
public void Write(LogKind logKind, string format, params object[] args) { var s = string.Format(EnvironmentHelper.MainCultureInfo, format, args).AddPrefixMultiline(Prefix); if (!isNewLine) s = s.Remove(0, Prefix.Length); Logger.Write(logKind, s); isNewLine = s.EndsWith("\n"); }
public void Write(LogKind logKind, string format, params object[] args) { CapturedOutput.Add(new OutputLine { Kind = logKind, Text = args.Length == 0 ? format : string.Format(CultureInfo.InvariantCulture, format, args) }); }
public void Write(LogKind logKind, string text) { if (isNewLine) { Logger.Write(logKind, Prefix); isNewLine = false; } Logger.Write(logKind, text); }
public OneLog(DateTime dt, LogKind logKind, String nameTag, long threadId, String remoteHostname, int messageNo, String message, String detailInfomation) { _dt = dt; _logKind = logKind; _nameTag = nameTag; _threadId = threadId; _remoteHostname = remoteHostname; _messageNo = messageNo; _message = message; _detailInfomation = detailInfomation; }
internal Log(LogKind kind, string message, Exception exception, [CallerFilePath] string fileName = null, [CallerLineNumber] int fileLine = 0, [CallerMemberName] string memberName = null) { this.kind = kind; this.message = message; this.exceptionMessage = exception.Message; #if DEBUG this.fileName = fileName; this.fileLine = fileLine; this.memberName = memberName; #endif }
public void Log(string msg, LogKind kind) { this.xwr.WriteStartElement("message", LogFileNamespace); switch (kind) { case LogKind.Error: this.xwr.WriteAttributeString("kind", "error"); break; case LogKind.Warning: this.xwr.WriteAttributeString("kind", "warning"); break; } this.xwr.WriteString(msg); this.xwr.WriteEndElement(); }
public void Log(string msg, LogKind kind) { if (!atStartOfLine) { Console.WriteLine("..."); atStartOfLine = true; } var savedColor = Console.ForegroundColor; switch (kind) { case LogKind.Error: Console.ForegroundColor = ConsoleColor.Red; break; case LogKind.Warning: Console.ForegroundColor = ConsoleColor.Yellow; break; } Console.WriteLine(msg); Console.ForegroundColor = savedColor; }
static void Log(LogKind kind, string message) { if (!DebugMode) return; if ((int)kind < (int)SettingsManager.Current.Verbosity) return; string kindStr = ""; switch (kind) { case LogKind.Notice: kindStr = "Notice: "; break; case LogKind.Warning: kindStr = "Warning: "; break; case LogKind.Error: kindStr = "Error: "; break; case LogKind.Fatal: kindStr = "Fatal: "; break; } string logStr = "[" + DateTime.Now + "] " + kindStr + message; if (SettingsManager.Current.LogToDebugConsole) { Debug.WriteLine(logStr); } if (SettingsManager.Current.LogToFile) { SW.WriteLine(logStr); } }
public void Set(LogKind logKind,SockObj sockBase,int messageNo,string detailInfomation) { if (_logger != null){ _logger.Set(logKind, sockBase, messageNo, detailInfomation); } }
public void WriteLine(LogKind logKind, string text) => Console.WriteLine(text);
public void WriteLine(LogKind logKind, string text) { builder.AppendLine(text); Flush(); }
public void WriteLine(LogKind logKind, string text) { _buffer.AppendLine(text); }
public override void WriteLine(LogKind logKind, string text) { _testOutputHelper.WriteLine(_currentLine + RemoveInvalidChars(text)); _currentLine = ""; base.WriteLine(logKind, text); }
public void WriteLine(LogKind logKind, string text) { IsActivated = true; }
public virtual void Write(LogKind logKind, string format, params object[] args) => builder.Append(string.Format(EnvironmentHelper.MainCultureInfo, format, args));
public void WriteLine(LogKind logKind, string text) => internalLogger.WriteLine(logKind, Escape(text));
public override void Write(LogKind logKind, string text) { currentLine += RemoveInvalidChars(text); base.Write(logKind, text); }
public override void WriteLine(LogKind logKind, string text) { testOutputHelper.WriteLine(currentLine + RemoveInvalidChars(text)); currentLine = ""; base.WriteLine(logKind, text); }
public void Write(LogKind logKind, string format, params object[] args) { foreach (var logger in loggers) logger.Write(logKind, format, args); }
private void WriteSimple(LogKind logKind, string text) { AddPrefixIfNeeded(logKind, text); Logger.Write(text); }
public new void Set(LogKind logKind, SockObj sockObj, int messageNo, String detailInfomation) { _ar.Add(new LogTemporary(logKind, sockObj, messageNo, detailInfomation)); }
public void LogWithLocation(string code, string msg, Location loc, LogKind kind, bool isRelated) { this.xwr.WriteStartElement("message", LogFileNamespace); switch (kind) { case LogKind.Error: this.xwr.WriteAttributeString("kind", "error"); break; case LogKind.Warning: this.xwr.WriteAttributeString("kind", "warning"); break; } if (isRelated) { this.xwr.WriteAttributeString("isRelated", "true"); } if (!String.IsNullOrEmpty(code)) { this.xwr.WriteAttributeString("code", code); } this.WriteLocation(loc); this.xwr.WriteString(msg); this.xwr.WriteEndElement(); }
public void WriteLine(LogKind logKind, string text) => _logger.WriteLine(logKind, $"{logKind.ToString()} - {text}");
/// <summary>Write the line.</summary> /// <param name="logKind">Kind of text.</param> /// <param name="text">The text to write.</param> public void WriteLine(LogKind logKind, string text) => _writerLazy.Value.WriteLine(text);
#pragma warning restore 420 /// <summary>Checks if the line should be written.</summary> /// <param name="logKind">The kind of log message.</param> /// <returns><c>true</c> if the line should be written.</returns> protected virtual bool ShouldWrite(LogKind logKind) => LogFilter == LogFilter.AllMessages || _importantAreaCount > 0 || // ReSharper disable once ArrangeRedundantParentheses ((logKind == LogKind.Error || logKind == LogKind.Hint) && LogFilter == LogFilter.PrefixedOrErrors);
private string GetColor(LogKind logKind) => colorScheme.TryGetValue(logKind, out var color) ? color : DefaultColor;
public void WriteLine(LogKind logKind, string text) { IsActivated = true; }
/// <summary> /// Overloaded constructor. /// </summary> /// <param name="kind">message log type</param> /// <param name="message">The message to be logged</param> /// <param name="parameters">extended parameters</param> public MessageLogEventArgs(LogKind kind, string message, object[] parameters) { this.kind = kind; this.message = message; this.parameters = parameters; }
public virtual void Write(LogKind logKind, string text) => builder.Append(text);
public override void WriteLine(LogKind logKind, string text) { testOutputHelper.WriteLine(currentLine + text); currentLine = ""; base.WriteLine(logKind, text); }
public void WriteLine(LogKind logKind, string text) { Write(logKind, text); WriteLine(); }
public void Write(LogKind logKind, string text) => builder.Append(text);
public void Write(LogKind logKind, string text) { this.output.Append(text); }
public override void Write(LogKind logKind, string text) { _currentLine += text; base.Write(logKind, text); }
public void WriteLine(LogKind logKind, string text) => output.AppendLine(text);
private void WriteLog(LogKind kind, string message, Exception exception, string fileName, int fileLine, string memberName) { lock (this.syncRoot) { this.logs.Add(new Log(kind, message, exception, fileName, fileLine, memberName)); } }
private void Log(LogKind kind, string text, HtmlNode tnode = null) { string message = null; if (tnode != null) { if (this.currentFileName != null) { message = string.Format("{0} in {2} at ({3},{4}): {1}", kind.ToString().ToUpper(), text, this.currentFileName, tnode.Line, tnode.LinePosition); } else { message = string.Format("{0} at ({3},{4}): {1}", kind.ToString().ToUpper(), text, tnode.Line, tnode.LinePosition); } } else { message = string.Format("{0}: {1}", kind.ToString().ToUpper(), text); } if (LogFile != null) { LogFile.WriteLine(message); } else { Console.WriteLine(message); } }
void Log(LogKind logKind, int messageNo, string msg) { if(_logger != null){ _logger.Set(logKind, _sockObj, messageNo, msg); } }
public void Write(LogKind logKind, string format, params object[] args) => writer.Write(args.Length == 0 ? format : string.Format(cultureInfo, format, args));
public override void WriteLine(LogKind logKind, string text) { testOutputHelper.WriteLine(text); base.WriteLine(logKind, text); }
public void WriteLine(LogKind logKind, string text) { stringBuilder.AppendLine(text); }
public void Write(LogKind logKind, string format, params object[] args) { Console.ForegroundColor = GetColor(logKind); Console.Write(args.Length == 0 ? format : string.Format(cultureInfo, format, args)); Console.ForegroundColor = DefaultColor; }
public void Log(string msg, LogKind kind = LogKind.Message) { this.DoForAll(logger => logger.Log(msg, kind)); }
private void Write(LogKind logKind, Action <object> write, string text) => write(WithStyle(text, "color:" + GetColor(logKind) + ";font-family:Consolas,'Lucida Console','Courier New',monospace"));
protected override void Init() { _dt = new DateTime(0); _logKind = LogKind.Normal; _threadId = 0; _nameTag = "UNKNOWN"; _remoteHostname = ""; _messageNo = 0; _message = ""; _detailInfomation = ""; }
public override void Write(LogKind logKind, string text) { _currentLine += RemoveInvalidChars(text); base.Write(logKind, text); }
/// <summary> /// Overloaded constructor. /// </summary> /// <param name="kind">message log type</param> /// <param name="condition">the check condition</param> /// <param name="message">the error message to be logged</param> /// <param name="parameters">extended parameters</param> public MessageLogEventArgs(LogKind kind, bool condition, string message, object[] parameters) { this.kind = kind; this.condition = condition; this.message = message; this.parameters = parameters; }
public void WriteLine(LogKind logKind, string text) { }
/// <summary>Writes text.</summary> /// <param name="logKind">Kind of text.</param> /// <param name="text">The text to write.</param> public void Write(LogKind logKind, string text) => _output.Write(text);
private ConsoleColor GetColor(LogKind logKind) => colorScheme.ContainsKey(logKind) ? colorScheme[logKind] : DefaultColor;
public LogType(LogKind kind, string msg) { Kind = kind; Message = msg; }
public void WriteLine(LogKind logKind, string text) { Console.ForegroundColor = GetColor(logKind); Console.WriteLine(text); Console.ForegroundColor = DefaultColor; }
/// <summary> /// Overloaded constructor. /// </summary> /// <param name="kind">message log type</param> /// <param name="message">the message to be logged</param> /// <param name="parameters">extended parameters</param> public MessageLogEventArgs(LogKind kind, string message, object[] parameters) { this.kind = kind; this.message = message; this.parameters = parameters; }
public void Write(LogKind logKind, string text) => Write(logKind, Console.Write, text);
public void WriteLine(LogKind logKind, string text) { Write(logKind, text); WriteLine(); }
private ConsoleColor GetColor(LogKind logKind) => colorScheme.ContainsKey(logKind) ? colorScheme[logKind] : DefaultColor;
// Private Methods (2) private static Guid AddLog(SPWeb spWeb, string message, string stackTrace, XElement details, LogKind kind, ObjectKind?objectKind, ActivityKind?activityKind) { Guid id = Guid.NewGuid(); if (objectKind.HasValue) { details.Add(new XElement("ObjectKind", objectKind.Value.ToString())); } if (activityKind.HasValue) { details.Add(new XElement("ActivityKind", activityKind.Value.ToString())); } const string SQL = @"INSERT INTO SS_Logs (Id, Message, StackTrace, Details, Kind, WebId, UserId) VALUES (@Id, @Message, @StackTrace, @Details, @Kind, @WebId, @UserId)"; SPSecurity.RunWithElevatedPrivileges(() => { string cs = CoreFunctions.getReportingConnectionString(spWeb.Site.WebApplication.Id, spWeb.Site.ID); using (var sqlConnection = new SqlConnection(cs)) { using (var sqlCommand = new SqlCommand(SQL, sqlConnection)) { sqlCommand.Parameters.AddWithValue("@Id", id); sqlCommand.Parameters.AddWithValue("@Message", message); sqlCommand.Parameters.AddWithValue("@StackTrace", stackTrace ?? string.Empty); sqlCommand.Parameters.AddWithValue("@Details", details.ToString()); sqlCommand.Parameters.AddWithValue("@Kind", kind); sqlCommand.Parameters.AddWithValue("@WebId", spWeb.ID); sqlCommand.Parameters.AddWithValue("@UserId", spWeb.CurrentUser.ID); sqlConnection.Open(); sqlCommand.ExecuteNonQuery(); } } }); return(id); }