-3

If a user has indented errors/log messages as code using four spaces or backticks, and the post is readable, should you still correct the mistake by using the > to make the errors/log messages a quote?

Example:

I wrote code good

foo = ab + c;

But I get errors in log

[Sun May 10 20:05:51.589483 2015] [:error] [client ::1:55388] PHP Fatal error:  Allowed memory size of 63 bytes exhausted (tried to allocate 64 bytes) in example.php on line 123
[Sun May 10 20:05:51.589483 2015] [:error] [client ::1:55388] PHP Fatal error:  Allowed memory size of 63 bytes exhausted (tried to allocate 64 bytes) in example.php on line 123
[Sun May 10 20:05:51.589483 2015] [:error] [client ::1:55388] PHP Fatal error:  Allowed memory size of 63 bytes exhausted (tried to allocate 64 bytes) in example.php on line 123

Should the log messages be quote's instead, even if it makes the question harder to read?

[Sun May 10 20:05:51.589483 2015] [:error] [client ::1:55388] PHP Fatal error: Allowed memory size of 63 bytes exhausted (tried to allocate 64 bytes) in example.php on line 123[Sun May 10 20:05:51.589483 2015] [:error] [client ::1:55388] PHP Fatal error: Allowed memory size of 63 bytes exhausted (tried to allocate 64 bytes) in example.php on line 123 [Sun May 10 20:05:51.589483 2015] [:error] [client ::1:55388] PHP Fatal error: Allowed memory size of 63 bytes exhausted (tried to allocate 64 bytes) in example.php on line 123

In my mind common sense says that you should leave them unquoted as it can be easier to debug if formatted well.

On the other hand, having it follow the style guide will help users quickly identify items of the code that matter to them.

Whats the general concensus on what to do in this situation?

3
  • 3
    You have to add lines breaks if you are going to change to a quote. A line break is two spaces at the end of the line. Commented May 10, 2015 at 20:05
  • No, there's certainly better ways to format those log lines. Consider code formatting style + indented line breaks. Horizontal scroll bars aren't really acceptable though. Commented May 10, 2015 at 20:05
  • Thank you I knew it would be something obvious
    – Jonny C
    Commented May 10, 2015 at 20:08

2 Answers 2

8

I'm not exactly a fan of either format since it adds noise to the actual problem ( which is "simply" PHP Fatal error: Allowed memory size of 63 bytes exhausted (tried to allocate 64 bytes) in example.php on line 123).

But if I had to choose, I'd rather have the code-indented form.

An edit to make that more readable would attempt to strip out duplicated and repeated log lines and attempt to condense them a bit to get the true kernel of the issue out into the open. Editing them into block quotes would make things look messier and much less readable.

I do say "edit the logs", but I should caution that one does this with a scapel, not a machete. There are select situations in which having a lot of log information is useful, so read the log statement critically; if there's a lot of blase log information that overtakes the actual error in the logs, then I don't see an issue trimming the logs down to maybe a few lines of logging context and the error itself.

4

Neither format is terribly readable, suggesting the best thing to do is actually to clean up the output (in this case, deleting [Sun May 10 20:05:51.589483 2015] [:error] [client ::1:55388]).

I don't think it's a "mistake" to indent output and the like so they display in a monospaced font, that's often how people like to read text output. But if you really want to convey that the text is a quote, you can always quote and monospace it. E.g.:

>     PHP Fatal error:  Allowed memory size of 63 bytes exhausted

Which becomes:

PHP Fatal error:  Allowed memory size of 63 bytes exhausted

You can also disable syntax highlighting if it's a problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .