Closed moreal closed 3 years ago
Hi I came to this issue thank to the hacktoberfest, could it be asigned to me? If I understood correctly, what needs to be done is replace Console.WriteLine
with Console.Error.WriteLine
for just this line of code:
Console.WriteLine("Creating Swarm.");
Is that right?
Hi I came to this issue thank to the hacktoberfest, could it be asigned to me? If I understood correctly, what needs to be done is replace
Console.WriteLine
withConsole.Error.WriteLine
for just this line of code:Console.WriteLine("Creating Swarm.");
Is that right?
Hello @brunocasarotti. As you said, this issue was exactly created from the line. But I expected to use Console.Error.WriteLine
over all lines by each situation. For instance, these lines:
https://github.com/planetarium/libplanet-explorer/blob/3302e65f20551cd80fbfddf559b43b008c46995d/Libplanet.Explorer.Executable/Program.cs#L75-L76 https://github.com/planetarium/libplanet-explorer/blob/3302e65f20551cd80fbfddf559b43b008c46995d/Libplanet.Explorer.Executable/Program.cs#L200 https://github.com/planetarium/libplanet-explorer/blob/3302e65f20551cd80fbfddf559b43b008c46995d/Libplanet.Explorer.Executable/Program.cs#L206 https://github.com/planetarium/libplanet-explorer/blob/3302e65f20551cd80fbfddf559b43b008c46995d/Libplanet.Explorer.Executable/Program.cs#L185
I wonder how @dahlia who suggested to use stderr think.
The reason why we prefer stderr over stdout is to make them machine readable, i.e, pipe-friendly. As messages written in a human language are not easy to parse, such messages should opt out of stdout and opt into stderr instead. On the other hand, numbers, paths, tokens, identifiers, etc, which are all intended to be parsed by other programs through pipe, should have structured formats and be written into stdout.
Basically, messages that this program prints are human-readable logs for the most part, and the program is designed to never terminate until it gets SIGINT
(^C), I believe Console.Write()
/Console.WriteLine()
should be avoided at all and replaced by corresponding method calls to Console.Error
.
We can use
Console.WriteLine
orConsole.Error.WriteLine
to print message on console. This issue means let's useConsole.Error.WriteLine
to print messages. You can read this article.Reference https://github.com/planetarium/libplanet-explorer/pull/98#discussion_r457895845.