3
* GNOME Do is the legal property of its developers. Please refer to the
4
* COPYRIGHT file distributed with this
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
using System.Diagnostics;
28
/// Provides a way for plugins to offer debugging info the Do log.
29
/// Uses reflection to determine which plugin is requesting a log write.
31
public static class LogBridge
34
/// Print a Log message with Debug severity.
36
/// <param name="msg">
37
/// A <see cref="System.String"/> containing the message to be printed
39
/// <param name="args">
40
/// A <see cref="System.Object"/> params array with any stacktraces,
43
public static void Debug (string msg, params object [] args)
45
string message = new StackTrace ().GetFrame (1).GetMethod ().DeclaringType.Namespace
47
DebugLogRequested (message, args);
51
/// Print a Log message with Info severity.
53
/// <param name="msg">
54
/// A <see cref="System.String"/> containing the message to be printed
56
/// <param name="args">
57
/// A <see cref="System.Object"/> params array with any stacktraces,
60
public static void Info (string msg, params object [] args)
62
string message = new StackTrace ().GetFrame (1).GetMethod ().DeclaringType.Namespace
64
InfoLogRequested (message, args);
68
/// Print a Log message with Warn severity.
70
/// <param name="msg">
71
/// A <see cref="System.String"/> containing the message to be printed
73
/// <param name="args">
74
/// A <see cref="System.Object"/> params array with any stacktraces,
77
public static void Warn (string msg, params object [] args)
79
string message = new StackTrace ().GetFrame (1).GetMethod ().DeclaringType.Namespace
81
WarnLogRequested (message, args);
85
/// Print a Log message with Error severity.
87
/// <param name="msg">
88
/// A <see cref="System.String"/> containing the message to be printed
90
/// <param name="args">
91
/// A <see cref="System.Object"/> params array with any stacktraces,
94
public static void Error (string msg, params object [] args)
96
string message = new StackTrace ().GetFrame (1).GetMethod ().DeclaringType.Namespace
98
ErrorLogRequested (message, args);
102
/// Print a Log message with Fatal severity.
104
/// <param name="msg">
105
/// A <see cref="System.String"/> containing the message to be printed
107
/// <param name="args">
108
/// A <see cref="System.Object"/> params array with any stacktraces,
111
public static void Fatal (string msg, params object [] args)
113
string message = new StackTrace ().GetFrame (1).GetMethod ().DeclaringType.Namespace
115
FatalLogRequested (message, args);
118
public static event RequestLogHandler DebugLogRequested;
119
public static event RequestLogHandler InfoLogRequested;
120
public static event RequestLogHandler WarnLogRequested;
121
public static event RequestLogHandler ErrorLogRequested;
122
public static event RequestLogHandler FatalLogRequested;
124
public delegate void RequestLogHandler (string msg, params object [] args);