@@ -30,6 +30,14 @@ internal class ConsoleServicePSHostUserInterface : PSHostUserInterface, IHostUIS
30
30
31
31
#endregion
32
32
33
+ #region Public Constants
34
+
35
+ public const string DebugMessagePrefix = "DEBUG: " ;
36
+ public const string WarningMessagePrefix = "WARNING: " ;
37
+ public const string VerboseMessagePrefix = "VERBOSE: " ;
38
+
39
+ #endregion
40
+
33
41
#region Properties
34
42
35
43
internal IConsoleHost ConsoleHost
@@ -57,9 +65,9 @@ public ConsoleServicePSHostUserInterface(bool enableConsoleRepl)
57
65
{
58
66
if ( enableConsoleRepl )
59
67
{
60
- // Set the output encoding to Unicode so that all
61
- // Unicode characters are written correctly
62
- System . Console . OutputEncoding = System . Text . Encoding . Unicode ;
68
+ // Set the output encoding to UTF-8 so that special
69
+ // characters are written to the console correctly
70
+ System . Console . OutputEncoding = System . Text . Encoding . UTF8 ;
63
71
}
64
72
65
73
this . rawUserInterface =
@@ -338,9 +346,10 @@ public override void WriteDebugLine(string message)
338
346
if ( this . consoleHost != null )
339
347
{
340
348
this . consoleHost . WriteOutput (
341
- message ,
349
+ DebugMessagePrefix + message ,
342
350
true ,
343
- OutputType . Debug ) ;
351
+ OutputType . Debug ,
352
+ foregroundColor : ConsoleColor . Yellow ) ;
344
353
}
345
354
}
346
355
@@ -349,9 +358,10 @@ public override void WriteVerboseLine(string message)
349
358
if ( this . consoleHost != null )
350
359
{
351
360
this . consoleHost . WriteOutput (
352
- message ,
361
+ VerboseMessagePrefix + message ,
353
362
true ,
354
- OutputType . Verbose ) ;
363
+ OutputType . Verbose ,
364
+ foregroundColor : ConsoleColor . Blue ) ;
355
365
}
356
366
}
357
367
@@ -360,9 +370,10 @@ public override void WriteWarningLine(string message)
360
370
if ( this . consoleHost != null )
361
371
{
362
372
this . consoleHost . WriteOutput (
363
- message ,
373
+ WarningMessagePrefix + message ,
364
374
true ,
365
- OutputType . Warning ) ;
375
+ OutputType . Warning ,
376
+ foregroundColor : ConsoleColor . Yellow ) ;
366
377
}
367
378
}
368
379
0 commit comments