# Recognising logs as code?

**URL:** https://meta.discourse.org/t/recognising-logs-as-code/319269
**Category:** Support
**Tags:** unformatted-code-detector
**Created:** [June 16, 2019, 11:18pm UTC](https://meta.discourse.org/t/recognising-logs-as-code/319269 "2019-06-16T23:18:53Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![lionel-rowe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lionel-rowe/32/134288_2.png) [@lionel-rowe](https://meta.discourse.org/u/lionel-rowe)
#### Post date: [June 17, 2019, 9:13pm UTC](https://meta.discourse.org/t/recognising-logs-as-code/319269/2 "2019-06-17T21:13:35Z")

</div>

> [@tophee](#):
>
> Will this recognize logs as “code”?

It will recognize logs as code if they happen to “look like” code (i.e. contain any of the patterns that would flag a post as containing code). You can test it out on your content at [the demo link](https://theme-creator.discourse.org/theme/lionel-rowe/unformatted-code-detector).

> [@tophee](#):
>
> look for a date/time at the beginning of two consecutive lines

There are lots of ways to format a datetime, and not all log formats start each line with a datetime in any case. I guess detecting full ISO8601 representations (`1970-01-01T00:00:00+00:00` etc.) would work, as these are very unlikely to appear outside of code or logs.

> [@tophee](#):
>
> will ir work when people are using quote-formating (`>`) instead of code fences?

Anything in code blocks (fenced or indented) is ignored. Quoted blocks don’t receive any special treatment. Quoted blocks aren’t a correct way to format code, and may lead to unexpected results.

Example: the string `<xml />`

Block quoted (gets parsed away into oblivion):

> 

Code fences (displays as intended):

```xml
<xml />

```

---

_[View the full topic](https://meta.discourse.org/t/recognising-logs-as-code/319269)._
