diff options
| author | Ac_K <Acoustik666@gmail.com> | 2020-01-13 01:21:54 +0100 |
|---|---|---|
| committer | Thog <me@thog.eu> | 2020-01-13 01:21:54 +0100 |
| commit | 5facc0c07f8a3f6fd0f39229044fe120501162a7 (patch) | |
| tree | 58ea7980cd38214806152b5f13f2427102a78564 /Ryujinx.Common/Logging | |
| parent | f0055482fd1aef9dcae7c6c4c6e01483f11f7839 (diff) | |
Name all threads (#886)
* Name all threads
Close #874
* use ThreadName instead of ThreadId in Logging
Diffstat (limited to 'Ryujinx.Common/Logging')
| -rw-r--r-- | Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs | 9 | ||||
| -rw-r--r-- | Ryujinx.Common/Logging/LogEventArgs.cs | 28 | ||||
| -rw-r--r-- | Ryujinx.Common/Logging/Logger.cs | 4 | ||||
| -rw-r--r-- | Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs | 1 |
4 files changed, 24 insertions, 18 deletions
diff --git a/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs b/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs index c6605e0e..73b0e2b6 100644 --- a/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs +++ b/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs @@ -18,8 +18,13 @@ namespace Ryujinx.Common.Logging sb.AppendFormat(@"{0:hh\:mm\:ss\.fff}", args.Time); sb.Append(" | "); - sb.AppendFormat("{0:d4}", args.ThreadId); - sb.Append(' '); + + if (args.ThreadName != null) + { + sb.Append(args.ThreadName); + sb.Append(' '); + } + sb.Append(args.Message); if (args.Data != null) diff --git a/Ryujinx.Common/Logging/LogEventArgs.cs b/Ryujinx.Common/Logging/LogEventArgs.cs index 2330dedd..af334632 100644 --- a/Ryujinx.Common/Logging/LogEventArgs.cs +++ b/Ryujinx.Common/Logging/LogEventArgs.cs @@ -4,28 +4,28 @@ namespace Ryujinx.Common.Logging { public class LogEventArgs : EventArgs { - public LogLevel Level { get; private set; } - public TimeSpan Time { get; private set; } - public int ThreadId { get; private set; } + public LogLevel Level { get; private set; } + public TimeSpan Time { get; private set; } + public string ThreadName { get; private set; } public string Message { get; private set; } public object Data { get; private set; } - public LogEventArgs(LogLevel level, TimeSpan time, int threadId, string message) + public LogEventArgs(LogLevel level, TimeSpan time, string threadName, string message) { - Level = level; - Time = time; - ThreadId = threadId; - Message = message; + Level = level; + Time = time; + ThreadName = threadName; + Message = message; } - public LogEventArgs(LogLevel level, TimeSpan time, int threadId, string message, object data) + public LogEventArgs(LogLevel level, TimeSpan time, string threadName, string message, object data) { - Level = level; - Time = time; - ThreadId = threadId; - Message = message; - Data = data; + Level = level; + Time = time; + ThreadName = threadName; + Message = message; + Data = data; } } }
\ No newline at end of file diff --git a/Ryujinx.Common/Logging/Logger.cs b/Ryujinx.Common/Logging/Logger.cs index 83af97b1..e3d82201 100644 --- a/Ryujinx.Common/Logging/Logger.cs +++ b/Ryujinx.Common/Logging/Logger.cs @@ -155,7 +155,7 @@ namespace Ryujinx.Common.Logging { if (m_EnabledLevels[(int)logLevel] && m_EnabledClasses[(int)logClass]) { - Updated?.Invoke(null, new LogEventArgs(logLevel, m_Time.Elapsed, Thread.CurrentThread.ManagedThreadId, message)); + Updated?.Invoke(null, new LogEventArgs(logLevel, m_Time.Elapsed, Thread.CurrentThread.Name, message)); } } @@ -163,7 +163,7 @@ namespace Ryujinx.Common.Logging { if (m_EnabledLevels[(int)logLevel] && m_EnabledClasses[(int)logClass]) { - Updated?.Invoke(null, new LogEventArgs(logLevel, m_Time.Elapsed, Thread.CurrentThread.ManagedThreadId, message, data)); + Updated?.Invoke(null, new LogEventArgs(logLevel, m_Time.Elapsed, Thread.CurrentThread.Name, message, data)); } } diff --git a/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs b/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs index c946b678..43c62d31 100644 --- a/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs +++ b/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs @@ -57,6 +57,7 @@ namespace Ryujinx.Common.Logging } }); + _messageThread.Name = "Logger.MessageThread"; _messageThread.IsBackground = true; _messageThread.Start(); } |
