Last updated
Last updated
Printing combines logging with Console.Write
statements. All printed messages are sent to the logger - if a logger was configured. INFO, WARN and ERROR messages are sent to Console, too.
Using the Printer with the nlog configuration from Demo5 you will see the following output:
The first message MSPro.CLArgs.ConsolePrinter
... apears, because the logger is configured to log to the console. The second line appers because Print.Info
prints to Console, too.
The advantage of using Print
is, that you can use logging but you can also go without. If you decide to implement logging later you can do this without changing your codebase. In addition, Print
is always there i(in the base class).
FInally, you can implement and provide your own IPrinter
implementation to control the outout as you want it. See the ConsolePrinter
for reference implementation.