Skip to content

Commit 7b16d3b

Browse files
committed
UnoCore: add object overloads in Uno.Diagnostics.Log
This makes it possible to pass arguments that are not strings to our logging methods.
1 parent d07701e commit 7b16d3b

File tree

1 file changed

+36
-0
lines changed
  • lib/UnoCore/src/Uno/Diagnostics

1 file changed

+36
-0
lines changed

lib/UnoCore/src/Uno/Diagnostics/Log.uno

+36
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ namespace Uno.Diagnostics
2525
_handler = handler;
2626
}
2727

28+
/** Writes a debug message to the log. */
29+
public static void Debug(object message)
30+
{
31+
WriteLine(LogLevel.Debug, message);
32+
}
33+
2834
/** Writes a debug message to the log. */
2935
public static void Debug(string message)
3036
{
@@ -37,6 +43,12 @@ namespace Uno.Diagnostics
3743
WriteLine(LogLevel.Debug, format, args);
3844
}
3945

46+
/** Writes an informational message to the log. */
47+
public static void Information(object message)
48+
{
49+
WriteLine(LogLevel.Information, message);
50+
}
51+
4052
/** Writes an informational message to the log. */
4153
public static void Information(string message)
4254
{
@@ -49,6 +61,12 @@ namespace Uno.Diagnostics
4961
WriteLine(LogLevel.Information, format, args);
5062
}
5163

64+
/** Writes a warning message to the log. */
65+
public static void Warning(object message)
66+
{
67+
WriteLine(LogLevel.Warning, message);
68+
}
69+
5270
/** Writes a warning message to the log. */
5371
public static void Warning(string message)
5472
{
@@ -61,6 +79,12 @@ namespace Uno.Diagnostics
6179
WriteLine(LogLevel.Warning, format, args);
6280
}
6381

82+
/** Writes an error message to the log. */
83+
public static void Error(object message)
84+
{
85+
WriteLine(LogLevel.Error, message);
86+
}
87+
6488
/** Writes an error message to the log. */
6589
public static void Error(string message)
6690
{
@@ -73,6 +97,12 @@ namespace Uno.Diagnostics
7397
WriteLine(LogLevel.Error, format, args);
7498
}
7599

100+
/** Writes a fatal error message to the log. */
101+
public static void Fatal(object message)
102+
{
103+
WriteLine(LogLevel.Fatal, message);
104+
}
105+
76106
/** Writes a fatal error message to the log. */
77107
public static void Fatal(string message)
78108
{
@@ -91,6 +121,12 @@ namespace Uno.Diagnostics
91121
WriteLine(level, string.Format(format, args));
92122
}
93123

124+
/** Writes a message to the log. */
125+
public static void WriteLine(LogLevel level, object message)
126+
{
127+
WriteLine(level, message != null ? message.ToString() : string.Empty);
128+
}
129+
94130
/** Writes a message to the log. */
95131
public static void WriteLine(LogLevel level, string message)
96132
{

0 commit comments

Comments
 (0)