question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

html logger not replacing template variables

See original GitHub issue

Hello! Thanks for all your efforts with this great library.

I’m running into an issue with the html logger, I did a fresh install pip install simplemonitor and I am using nginx:alpine to show the HTML. The page is loading, but I’m seeing the following errors (also see screenshot).

[Error] ReferenceError: Can't find variable: _INTERVAL_
	check_age (status.html:22)
	onload (status.html:30)

[Warning] jQuery.Deferred exception: Can't find variable: _INTERVAL_ – "check_age@http://REDACTED:8081/s/status.html:22:31↵http://REDACTED:8081/s/status.html:65:1…" – undefined (jquery-3.4.1.slim.min.js, line 2)

[Error] ReferenceError: Can't find variable: _INTERVAL_
	(anonymous function) (jquery-3.4.1.slim.min.js:2:31330)
Screen Shot 2020-06-06 at 12 02 44 PM

The page is refreshing at the interval I set (15), so I know it is working…I’m just not sure what the issue is with the template vars. I don’t support you have an idea of what I am doing wrong?

A few more details, comparing the code vs what is generated SOME template variables are working. Here is the code vs. what is rendered in my browser (latest Safari)

https://github.com/jamesoff/simplemonitor/blob/develop/simplemonitor/html/header.html#L7

<title>OK@5d77549f5fa3 Monitor</title>

https://github.com/jamesoff/simplemonitor/blob/develop/simplemonitor/html/header.html#L11

<meta http-equiv="refresh" content="_INTERVAL_" />

https://github.com/jamesoff/simplemonitor/blob/develop/simplemonitor/html/header.html#L21

var generated = 1591463515;

https://github.com/jamesoff/simplemonitor/blob/develop/simplemonitor/html/header.html#L24

if (diff > (_INTERVAL_ * 2)) {

https://github.com/jamesoff/simplemonitor/blob/develop/simplemonitor/html/header.html#L33

<div class="navbar navbar-light bg-light border-bottom OKBORDER_" id="summary">

https://github.com/jamesoff/simplemonitor/blob/develop/simplemonitor/html/header.html#L35

<div class="navbar-text d-none d-lg-block" id="updated">
Updated at 2020-06-06 17:11:55 by 5d77549f5fa3 (_VERSION_)
</div>

https://github.com/jamesoff/simplemonitor/blob/develop/simplemonitor/html/header.html#L37

<div class="navbar-text">
  <div id="summary" class="ok">
    OK
  <div id="details">
    <span class="ok">1 OK</span>
    <span class="fail">0 FAIL</span>
    <span class="old">0 OLD</span>
    <span class="remote">0 remote</span>
  </div>
</div>
</div>

Here is the generated HTML table contents

<tr class="okrow">
  <td class="monitor_name">localhost</td>
  <td class="status ok">OK</td>
  <td>5d77549f5fa3</td>
  <td></td>
  <td class="vfc">&nbsp;</td>
  <td>0+00:00:00</td>
  <td> &nbsp;</td>
  <td></td>
  <td></td>
  <td></td>
</tr>

https://github.com/jamesoff/simplemonitor/blob/develop/simplemonitor/html/footer.html#L2

<div class="navbar-text d-block d-lg-none" id="updated">
Updated at 2020-06-06 17:20:03<br />by 5d77549f5fa3 (_VERSION_)
</div>

Thanks

[Edit]: cleanup and details

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
chriskacerguiscommented, Jun 6, 2020

awesome. thanks so much for your help with this and taking some of your free time to take a look.

1reaction
jamesoffcommented, Jun 6, 2020

Cheers for the info. Something definitely not right there, I recall fixing something similar but thought it was after 1.9.0. Let me test it out on a fresh install…

Read more comments on GitHub >

github_iconTop Results From Across the Web

${variable} doesnt get replaced when html template is read as ...
The below code works as image template variable is replaced by its value in htmlstring string: main.js var image = fs.
Read more >
Template variables are not replaced · Issue #223 - GitHub
I am trying to use some templated variables in my template, ... If you use a html file and use a html loader...
Read more >
Logging HOWTO — Python 3.11.1 documentation
To log variable data, use a format string for the event description message and append the variable data as arguments. For example: import...
Read more >
Logging in .NET Core and ASP.NET Core | Microsoft Learn
In this article. Logging providers; Create logs; Configure logging; Log in Program.cs; Set log level by command line, environment variables, and ...
Read more >
Live template variables | IntelliJ IDEA Documentation - JetBrains
When you expand a live template abbreviation, its variables either appear as input fields where you can type values or are replaced with ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found