Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
node-logs-sqlite
Advanced tools
Readme
A class to manage logs
$ npm install node-logs-sqlite
node-logs inheritage
-- Interfaces --
interface iLogDate {
year: string,
month: string,
day: string
}
interface iLog {
date: string,
time: string,
type: string,
message: string
}
-- Constructor --
constructor ()
-- Methods --
-- Accessors --
deleteLogsAfterXDays (deleteLogsAfterXDays: number): this
localStorageDatabase (localStorageDatabase: string): this
-- Init / Release --
init(): Promise< resolve<void> | reject<Error> >
create local storage if not exists and delete old logs
release(): Promise< resolve<void> | reject<Error> >
-- Read logs --
getLogs(): Promise< resolve< Array<iLogDate> > | reject<Error> >
readLog(year: string|number, month: string|number, day: string|number): Promise< resolve< Array<iLog> > | reject< ReferenceError|TypeError|Error > >
const Logs = require("node-logs-sqlite");
const logs = new Logs();
// optionnal : configure the logger
logs
.deleteLogsAfterXDays(2)
.localStorageDatabase(require("path").join(__dirname, "logs.db"))
.showInConsole(true);
return logs.init().then(() => {
return logs.log("this is a message", [ "background" ]);
}).then(() => {
return logs.getLogs().then((logs) => {
return logs.readLog(year, month, day);
}).then((logs) => {
console.log(logs); return Promise.resolve();
});
}).then(() => {
return logs.release();
}).catch((err) => {
console.log(err);
});
import Logs = require("node-logs-sqlite");
const logs = new Logs();
logs.init().then(() => {
return logs.log("log");
});
$ npm run-script tests
FAQs
A class to manage logs with sql base
The npm package node-logs-sqlite receives a total of 8 weekly downloads. As such, node-logs-sqlite popularity was classified as not popular.
We found that node-logs-sqlite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.