Logic Machine Forum
Log on html widget - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Log on html widget (/showthread.php?tid=3391)



Log on html widget - CristianAgata - 28.05.2021

Hi everybody,
Is it possible move the log schedule in a html widget in mosaic?
My will it is to see the log() function inside a script in mosaic.
I need it for a diagnostic reason.
Br Cristian


RE: Log on html widget - admin - 31.05.2021

You can place it via an iframe similar to this example: https://forum.logicmachine.net/showthread.php?tid=3331
Keep in mind that this will work only locally, not via cloud.
Code for logs.lp:
Code:
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <link rel="stylesheet" href="/apps/css/bootstrap.css">
</head>
<body>
<table class="table table-striped">
<tr>
  <th>Date/time</th>
  <th>Script name</th>
  <th>Log</th>
</tr>
<?
require('apps')

items = db:getall([[
  SELECT * FROM logs
  ORDER BY logtime DESC
  LIMIT 50
]])

for _, item in ipairs(items) do
  datetime = os.date('%Y.%m.%d %H:%M:%S', item.logtime)
?>
<tr>
  <td><?=datetime?></td>
  <td><?=escape(item.scriptname)?></td>
  <td><?=escape(item.log)?></td>
</tr>
<? end ?>
</table>
</body>
</html>