When I see an unformatted error log, I format it as


I've noticed, however, that some other users format them as


Which is better?

tessdata_manager.SeekToStart(TESSDATA_INTTEMP):Error:Assert failed:in file adaptmatch.cpp, line 555


tessdata_manager.SeekToStart(TESSDATA_INTTEMP):Error:Assert failed:in file adaptmatch.cpp, line 555
  • 7
    Whatever is more readable, I think. Sometimes it's a blockquote and other times it's a code block. – Adam Lear ModStaff Jun 25 '13 at 20:29
  • 3
    When formatting them as code, add <!-- language: lang-none --> to disable the syntax highlighter. meta.stackexchange.com/questions/981/… – Rocket Hazmat Jun 25 '13 at 20:34

In this specific instance, I think the "better" way would be:

Error:Assert failed:in file adaptmatch.cpp, line 555

That is, as a code block, with a newline added by hand to prevent horizontal scrolling.

Syntax highlighting does not seem to kick in on your example, but even when it does it can sometimes have a positive effect (e.g. emphasis on numbers).

(For instance, here is an old answer of mine that contains ugly ASCII-art diagrams in code blocks, and syntax highlighting actually improves things IMHO.)

  • In the case of your example you seem to have specifically written it knowing that it would be fed into a syntax highlighter and you adjusted the text in several ways specifically to get the highlights that you wanted. Since most people won't be doing that, it's almost always best to have the syntax highlighting disabled. – Servy Jun 25 '13 at 20:38
  • 1
    @Servy, I can assure you I composed that answer in the raw editor without looking at the preview, using my own conventions, and was amazed single-quoted text and properly capitalized sentences ended up rendering like this :) – Frédéric Hamidi Jun 25 '13 at 20:39
  • @FrédéricHamidi The point still stands; in the vast majority of cases it won't render in a sensible manor. – Servy Jun 25 '13 at 20:40
  • Seems like a lot more work to go through a block of text adjusting the linebreaks. What's the compelling reason for wanting to use code formatting and adding in that extra work? – Servy Jun 25 '13 at 20:41
  • @Servy, in this particular case, logs are usually meant to be read with a fixed-sized font, and look ugly with the variable-sized font used in quotes? – Frédéric Hamidi Jun 25 '13 at 20:42
  • @FrédéricHamidi I generally don't find that to be true in the general case. You can use <pre> if you want to use fixed-width font, perhaps for some specific case where it's relevant. – Servy Jun 25 '13 at 20:44
  • @Servy, true, I always forget some HTML elements are allowed in our posts (Markdown is probably spoiling me). On the semantic side of things, it looks like you consider logs to be "text" rather than "code", but my own (limited) experience makes me think the opposite :) – Frédéric Hamidi Jun 25 '13 at 20:49

I find the workflow rather simple.

Is the text code:

yes -> use code markdown
no -> don't use code markdown

Also, if you decide to use code markdown anyway, at least ensure that syntax highlighting is disabled so that there isn't nonsensical color highlighting.

  • And is an error log code, or text? Is it text telling you what's wrong with your code, or is it code telling you what's wrong with your text? – Undo Jun 25 '13 at 20:30
  • @Undo An error log is text that may or may not be referring to code. – Servy Jun 25 '13 at 20:30
  • What about when it is an error log with a bunch of code in it - like NSString failed with double value of an NSNumber? – Undo Jun 25 '13 at 20:32
  • @Undo I don't see code in that quote... – Servy Jun 25 '13 at 20:33
  • NSNumber, NSString, etc. – Undo Jun 25 '13 at 20:34
  • @Undo I don't really see that as code...and even if you do, it certainly is perfectly readable if not formatted as code. Now if you have a bunch of text that isn't being rendered properly because it has a bunch of angle brackets or something like that then it becomes a different case. – Servy Jun 25 '13 at 20:37

You must log in to answer this question.

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