8d382afa0f
This commit introduces the ability to handle log files through the API and provides a new log viewing page. The API now supports GET and DELETE methods for log file operations, allowing retrieval and deletion of log contents. A new log.html page has been added for viewing logs in the browser, with automatic refresh every 5 seconds and styling based on log levels. The app.go file has been updated to include a GetLogFilepath function that retrieves or generates the log file path. The NewLogger function now accepts a file parameter to enable file logging. The main.js file has been updated to include a link to the new log.html page. This enhancement improves the observability and management of the application by providing real-time access to logs and the ability to clear them directly from the web interface.
54 lines
816 B
JavaScript
54 lines
816 B
JavaScript
// main menu
|
|
document.body.innerHTML = `
|
|
<style>
|
|
ul {
|
|
list-style: none;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
a {
|
|
text-decoration: none;
|
|
font-family: 'Lora', serif;
|
|
transition: .5s linear;
|
|
}
|
|
|
|
i {
|
|
margin-right: 10px;
|
|
}
|
|
|
|
nav {
|
|
display: block;
|
|
/*width: 660px;*/
|
|
margin: 0 auto 10px;
|
|
}
|
|
|
|
nav ul {
|
|
padding: 1em 0;
|
|
background: #ECDAD6;
|
|
}
|
|
|
|
nav a {
|
|
padding: 1em;
|
|
background: rgba(177, 152, 145, .3);
|
|
border-right: 1px solid #b19891;
|
|
color: #695753;
|
|
}
|
|
|
|
nav a:hover {
|
|
background: #b19891;
|
|
}
|
|
|
|
nav li {
|
|
display: inline;
|
|
}
|
|
</style>
|
|
<nav>
|
|
<ul>
|
|
<li><a href="index.html">Streams</a></li>
|
|
<li><a href="add.html">Add</a></li>
|
|
<li><a href="editor.html">Config</a></li>
|
|
<li><a href="log.html">Log</a></li>
|
|
</ul>
|
|
</nav>
|
|
` + document.body.innerHTML;
|