@@ -18,8 +18,7 @@ public class ConsoleLogger : ILogger
18
18
/// <summary>
19
19
/// 控制台光标控制是否启用。
20
20
/// </summary>
21
- private bool _isCursorMovementEnabled ;
22
-
21
+ private readonly bool _isCursorMovementEnabled ;
23
22
private readonly RepeatLoggerDetector _repeat ;
24
23
private static bool _isConsoleOutput ;
25
24
private static readonly TextWriter Out = GetStandardOutputWriter ( ) ;
@@ -115,7 +114,7 @@ private void LogCore(LogLevel logLevel, Exception? exception, string message, Fu
115
114
{
116
115
if ( _isConsoleOutput )
117
116
{
118
- ConsoleMultilineMessage ( $ "上述日志已重复 { count } 次", formatter , true ) ;
117
+ ConsoleMultilineMessage ( $ "{ F . BrightBlack } 上述日志已重复 { count } 次{ Reset } ", formatter , true ) ;
119
118
}
120
119
else
121
120
{
@@ -185,13 +184,12 @@ internal static void SafeWriteLine(string? message)
185
184
/// 清空当前行并移动光标到上一行。
186
185
/// </summary>
187
186
/// <param name="repeatCount">此移动光标,是因为日志已重复第几次。</param>
188
- /// <returns>返回 <see langword="true"/> 表示成功移动了光标,返回 <see langword="false"/> 表示未能成功移动光标。</returns>
189
- private bool ClearAndMoveToLastLine ( int repeatCount )
187
+ private void ClearAndMoveToLastLine ( int repeatCount )
190
188
{
191
189
if ( ! _isCursorMovementEnabled )
192
190
{
193
191
// 如果光标控制不可用,或者还没有重复次数,则不尝试移动光标。
194
- return false ;
192
+ return ;
195
193
}
196
194
197
195
var width = Console . WindowWidth ;
@@ -209,8 +207,6 @@ private bool ClearAndMoveToLastLine(int repeatCount)
209
207
#else
210
208
Out . Write ( $ "{ cursorPreviousLine } { new string ( ' ' , width ) } { cursorHorizontalAbsolute0 } ") ;
211
209
#endif
212
-
213
- return true ;
214
210
}
215
211
216
212
public static int Clamp ( int value , int min , int max )
0 commit comments