log-report
Version:
A lightweight and efficient logging library for Node.js, designed for simplicity and flexibility.
146 lines (140 loc) • 6.33 kB
HTML
<html>
<head>
<title>Log Report</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css" />
<script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css" />
<script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/prism.min.js"></script>
<style>
#list-headers ul {
list-style: none;
padding-left: .5em;
}
#list-headers > ul {
padding: 0;
}
#list-headers h1, h2, h3, h4, h5 {
white-space: nowrap;
}
.markdown-body {
padding-left: 2em;
}
@media (min-width: 992px) {
.vh-lg-100{
height: 100vh ;
}
}
</style>
</head>
<body>
<div class="row w-100">
<div class="col-12 text-center">
<h1 id="log-report">Log Report</h1>
<p>A lightweight and efficient logging library for Node.js, designed for simplicity and flexibility.<br>
This manual is also available in <a href="https://manuel-lohmus.github.io/log-report/README.html">HTML5</a>.</p>
</div>
</div>
<div class="row w-100">
<div class="col-lg-3 d-lg-inline">
<div class="sticky-top overflow-auto vh-lg-100">
<div id="list-headers" class="list-group mt-2 ms-lg-2 ms-4">
<h4 id="table-of-contents">Table of contents</h4>
<ul>
<li><a href="#introduction"><strong>Introduction</strong></a></li>
<li><a href="#installation"><strong>Installation</strong></a></li>
<li><a href="#basic-usage"><strong>Basic Usage</strong></a></li>
<li><a href="#config-sets"><strong>Config Sets</strong></a></li>
<li><a href="#license"><strong>License</strong></a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-9 mt-2">
<div class="ps-4 markdown-body" data-bs-spy="scroll" data-bs-target="#list-headers" data-bs-offset="0" tabindex="0">
<h2 id="introduction">Introduction</h2>
<p>Log Report is a powerful yet simple tool designed to generate comprehensive reports of logs in a directory.<br />
It helps analyze logs to identify errors, warnings, and other critical information, making it especially useful for applications running in multiple threads.<br />
The tool is highly customizable, allowing you to tailor reports to your specific needs with ease.
This module is part of the <a href="https://www.npmjs.com/package/conextra">'conextra'</a> framework,
which is a simple and easy-to-use single-page application (SPA) framework.
You have to try it! A different solution than MVC (model–view–controller).</p>
<h2 id="installation">Installation</h2>
<p>To install the Log Report, you can use the following command:</p>
<pre><code class="language-bash">npm install log-report
</code></pre>
<h2 id="basic-usage">Basic Usage</h2>
<p>Short usage example:</p>
<pre><code class="language-javascript">/* short version */
require('log-report');
// Importing the 'log-report' module will automatically execute it in the current thread,
// saving the generated information.
</code></pre>
<p>Longer example:</p>
<pre><code class="language-javascript">/* longer version */
const logReport = require('log-report');
// Specifies the directory where logs will be saved.
logReport.logDir = "./log/log-report";
// Specify appropriate log file names.
logReport.stdoutFileName = "stdout.log";
logReport.stderrFileName = "stderr.log";
logReport.errorFileName = "error.log";
// This is useful if you want to start with fresh log files, especially during development or testing.
logReport.clearOnStartup = false;
// This is useful if you only want information about Uncaught Exception.
logReport.saveOnlyUncaughtException = false;
// This is useful if you want to get information about the PID of a process, especially during development or testing.
logReport.addProcessTag = false;
// This is useful if you want to get information about the file that started the process, especially during development or testing.
logReport.addFileTag = false;
// Suppresses terminal output when set to true.
logReport.silent = true;
// This is useful if you want to start with fresh log files, especially during development or testing.
logReport.clearLogFiles();
</code></pre>
<h2 id="config-sets">Config Sets</h2>
<p>Config sets define the configuration for the log report and are located in the <code>config-sets.json</code> file in the root directory of the project.<br />
They enable dynamic, real-time modification of settings. For example, setting <code>silent</code> to <code>true</code> suppresses terminal output.<br />
Refer to the <a href="https://manuel-lohmus.github.io/config-sets/README.html">Config-Sets</a> section for detailed instructions on defining and using config sets.</p>
<pre><code class="language-json">{
"isProduction": true,
"production": {
"log_report": {
"logDir": "./log/log-report",
"stdoutFileName": "stdout.log",
"stderrFileName": "stderr.log",
"errorFileName": "error.log",
"clearOnStartup": true,
"saveOnlyUncaughtException": true,
"addProcessTag": false,
"addFileTag": false,
"silent": false,
"enabled": true
}
},
"development": {}
}
</code></pre>
<h2 id="license">License</h2>
<p>This project is licensed under the MIT License.</p>
<p>Copyright © Manuel Lõhmus</p>
<br>
<br>
<br>
</div>
</div>
</div>
<script>
(function () {
'use strict';
var isIE = !!document.documentMode; // Detect IE
if (!isIE) {
// list-group style for headers
document.querySelectorAll('#list-headers a')
.forEach(function (a) { a.classList.add('list-group-item', 'list-group-item-action') });
}
})();
</script>
</body>
</html>