diff --git a/Duplicati/CommandLine/ConsoleLogTarget.cs b/Duplicati/CommandLine/ConsoleLogTarget.cs deleted file mode 100644 index 297ad1c2d..000000000 --- a/Duplicati/CommandLine/ConsoleLogTarget.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (C) 2018, The Duplicati Team -// http://www.duplicati.com, info@duplicati.com -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System; -using System.IO; -using Duplicati.Library.Logging; -using Duplicati.Library.Utility; - -namespace Duplicati.CommandLine -{ - /// - /// Log output handler for the console - /// - public class ConsoleLogTarget : Library.Logging.ILogDestination - { - /// - /// The stdout stream - /// - private readonly TextWriter m_stdout; - /// - /// The stderr stream - /// - private readonly TextWriter m_stderr; - /// - /// The default log level - /// - private readonly LogMessageType m_level; - /// - /// The filter, if any - /// - private readonly IFilter m_filter; - - /// - /// Initializes a new instance of the class. - /// - /// The stdout stream. - /// The stderr stream. - /// The minimum log level to consider. - /// The log filter, if any. - public ConsoleLogTarget(TextWriter stdout, TextWriter stderr, LogMessageType level, string logfilter) - { - m_stdout = stdout; - m_stderr = stderr; - m_level = level; - m_filter = FilterExpression.ParseLogFilter(logfilter); - } - - /// - /// Writes the message to stdout or stderr. - /// - /// The entry to write. - public void WriteMessage(LogEntry entry) - { - var found = m_filter.Matches(entry.FilterTag, out var result, out var match); - // If there is a filter match, use that - if (found) - { - if (!result) - return; - - if (entry.Level == LogMessageType.Error) - m_stderr.WriteLine(entry); - else - m_stdout.WriteLine(entry); - } - else - { - // Otherwise, filter by log-level - if (entry.Level < m_level) - return; - } - - if (entry.Level == LogMessageType.Error) - m_stderr.WriteLine(entry.FormattedMessage); - else - m_stdout.WriteLine(entry.FormattedMessage); - - } - } -} diff --git a/Duplicati/CommandLine/Duplicati.CommandLine.csproj b/Duplicati/CommandLine/Duplicati.CommandLine.csproj index 2b1bff925..ce68ac479 100644 --- a/Duplicati/CommandLine/Duplicati.CommandLine.csproj +++ b/Duplicati/CommandLine/Duplicati.CommandLine.csproj @@ -57,7 +57,6 @@ -