Gathering detailed insights and metrics for logitt
Gathering detailed insights and metrics for logitt
Gathering detailed insights and metrics for logitt
Gathering detailed insights and metrics for logitt
npm install logitt
Typescript
Module System
Node Version
NPM Version
61.4
Supply Chain
98
Quality
75
Maintenance
100
Vulnerability
100
License
EJS (51.52%)
TypeScript (48.48%)
Total Downloads
642
Last Day
1
Last Week
1
Last Month
12
Last Year
642
3 Stars
13 Commits
1 Forks
1 Branches
1 Contributors
Updated on Aug 09, 2024
Minified
Minified + Gzipped
Latest Version
1.0.6
Package Id
logitt@1.0.6
Unpacked Size
52.18 kB
Size
12.61 kB
File Count
29
NPM Version
9.8.1
Node Version
18.17.0
Published on
Jun 16, 2024
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-66.7%
1
Compared to previous week
Last Month
-72.1%
12
Compared to previous month
Last Year
0%
642
Compared to previous year
5
Logitt is a powerful NodeJS library for efficient log management. It seamlessly saves logs and offers an intuitive interface for exploring and analyzing them, enhancing your application's monitoring and debugging capabilities.
Using NPM:
$ npm install logitt
Using YARN:
$ yarn add logitt
Logitt provides a straightforward logger and an easy-to-use interface for viewing logs. Here's how to get started:
Configuration: Set up your environment variables before using the library.
Development Mode: By default, Logitt operates in "development" mode, displaying all logs in the console using Consola
Production Mode: To save logs to files (stored in the "/logs" folder), update your environment variables as follows:
1NODE_ENV="production"
Logitt employs the Singleton design pattern. You can configure the logger by changing the URL of the UI Explorer or by enabling/disabling tracing.
1const { Logitt } = require("logitt"); 2 3// Default configuration options 4const options = { 5 // Enable tracing to identify the source of the log 6 trace: true, 7 // Set the URL path for the UI Explorer 8 route: "/logs", 9}; 10 11// Create a new instance with custom options, if not already created 12const loggy = Logitt.getLogger(options); 13 14// Create a new instance with default options 15const loggy = Logitt.getLogger();
Logitt provides 4 logging levels: SUCCESS, DEBUG, WARNING, and ERROR.
Here's how to use them:
1loggy.warn("Warning occured here"); 2loggy.error("Error occured here"); 3loggy.debug("Debug occured here"); 4loggy.success("Success occured here"); 5 6// You can also log directly using the singleton instance 7// Logitt.getLogger().warn("Warning occured here")
To include additional context or metadata with your logs:
1loggy.error("Unable to create a new user", { 2 name: "John Doe", 3 email: "user@exmaple.com", 4 phone: null, 5});
To access the UI Explorer and view your logs, you need to set your credentials as environment variables:
1LOGITT_USERNAME=your_username 2LOGITT_PASSWORD=your_password
1const { Logitt } = require("logitt"); 2const http = require("http"); 3 4const loggy = Logitt.getLogger(); 5 6http.createServer(loggy.render).listen(PORT, () => { 7 consola.start(`Server is running on port ${PORT} ...\n`); 8});
1const { Logitt } = require("logitt"); 2const express = require("express"); 3 4const app = express(); 5 6app.get("/logs", Logitt.getLogger().render); 7 8// Custom URL 9app.get("/my-logs", Logitt.getLogger({ route: "/my-logs" }).render);
1import { Controller, Get, Req, Res } from "@nestjs/common"; 2import { Request, Response } from "express"; 3import { Logitt } from "logitt"; 4 5@Controller() 6export class AppController { 7 constructor() {} 8 9 @Get("/logs") 10 getLogs(@Req() req: Request, @Res() res: Response) { 11 let logitt = Logitt.getLogger(); 12 logitt.render(req, res); 13 } 14 15 // Custom URL 16 @Get("/my-logs") 17 getLogs(@Req() req: Request, @Res() res: Response) { 18 let logitt = Logitt.getLogger({ route: "/my-logs" }); 19 logitt.render(req, res); 20 } 21}
Copyright 2024
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
No vulnerabilities found.
No security vulnerabilities found.