npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

minimalist-logger

v1.0.8

Published

This module helps to identify where the call has started and control the log message.

Downloads

3

Readme

Minimalist-logger(https://npmjs.com/package/minimalist-logger)

Definition

This module helps to identify where the call has started and control the log message.

Custom USEFUL log function to string messages

To TEXT(string) messages, we have 5 methods

.l ([L]og) Multi-line, colored(header: default, body: yellow) .e ([E]rror) Multi-line, colored(header: default, body: red) .u ([U]nstyled) Multi-line, non-colored .s ([S]ingleLine) Single-line, colored(header: default, body: yellow) .i ([I]nline) Single-line, non-colored

Both of them have bellow parameters.

The only diference between them are the color of message.

.@param message The message will appear .@param docName (optional) The file name who calls the function .@param functionName (optional) The function name who calls the function .@param line (optional) The line of the call. Take care about edit code and change the line. .@param limit (optional) The amount of char of the message to display .@param startat (optional) The initial startpoint of the message. Useful when comes filtered string.

To OBJECT(any) stream messages, we have 2 methods

.o ([O]bject) Multi-line, colored(header: default, body: yellow) .w ([W]recked) Multi-line, colored(header: default, body: red) .p ([P]ure) Multi-line, non-colored

Both of o, w and p have bellow parameters. The only diference between them are the color of message.

Obs.: They call the identification header and to show the object, call standard console.log(), but chage the color

.@param message The object stream (system converted) message will appear .@param document (optional) The file name who calls the function .@param functionName (optional) The function name who calls the function .@param line (optional) The line of the call. Take care about edit code and change the line.

Installation

Just put npm i minimalist-logger on your favorite (and available) command application

Usage

When do You need to identify the local of current call, defines this: If You want, take bellow code and put in any JS empty file and run it.

var minLog = require('minimalist-logger');

/* The standard easy way to create a log call. Produces:
4.
5. [NAME_OF_THIS_DOCUMENT] >>> .L(11):
6. This is some message
7. [(IF INDEX.JS, E.G:) Index] >>> .E(12):
8. This is some message
9.
*/
minLog.l('This is some message');
minLog.e('This is some message');


/* Allow You to modify the line number and document name. Produces:
16.
17. >>> File.L(4):
18. This is some message
19. >>> File.ERROR(4)
20. This is some message
21.
*/
minLog.l('This is another some message', 'file', '', 4);
minLog.error('This is another some message', 'file', null, 4);


/* Limit the message length. Produces:
28.
29. [NAME_OF_THIS_DOCUMENT] >>> .LOG(35):
30. Too many messag...
31. [(IF INDEX.JS, E.G:) Index] >>> .E(36):
32. Too many messages to e...
33.
*/
minLog.log('Too many messages to explain this', '', null, null, 15);
minLog.e('Too many messages to explain this', null, '', null, 22);


/* Cut part of start message and limit its length, while modify the caller(function) name. Produces:
40.
41. >>> File_sys.Logger(9):
42. s.io: This is a too big m...
43. >>> File_sys.Logger(9):
44. This is a too big message...
45.
*/
minLog.l('Sys.io: This is a too big message just [for fun, ops...] for explain that we can take just what we need', 'file_sys', 'logger', 9, 25, 2);
minLog.e('Sys.io: This is a too big message just [for fun, ops...] for explain that we can take just what we need', 'file_sys', 'logger', 9, 25, 8);


/* Print full object (if possible). Produces:
53.
54. >>> File.O(62):
55. {"name": "Don","lastname": "johe"}
56. >>> WreckedFile.WRECKED(63):
57. {"name": "Don","lastname": "johe"}
58. [NO COLORS HERE] >>> PureFile.PURE(64):
59. [NO COLORS HERE] {"name": "Don","lastname": "johe"}
60.
*/
minLog.o(JSON.stringify({ "name": "Don", "lastname": "johe" }), 'file');
minLog.wrecked(JSON.stringify({ "name": "Don", "lastname": "johe" }), 'wreckedFile');
minLog.pure(JSON.stringify({ "name": "Don", "lastname": "johe" }), 'PureFile')


/* Print the log in a single-line and multi-line, without colors. Produces:
69.
70. >>> DocumentJson.I(78): [NO COLORS HERE] One text for no one ask for it
71. >>> DocumentJson.INLINE(79): [NO COLORS HERE] One text for no one ask for it
72. >>> DocumentJson.U(80):
73. [NO COLORS HERE] One text for no one ask for it
74. >>> DocumentJson.UNSTYLED(81):
75. [NO COLORS HERE] One text for no one ask for it
76.
*/
minLog.i('One text for no one ask for it');
minLog.inline('One text for no one ask for it');
minLog.u('One text for no one ask for it');
minLog.unstyled('One text for no one ask for it');

Note on version 1.0.0

The first release was a base concept to reduce to useful log.

Note on version 1.0.1

Add the readme(myself -) and follow corrections:

  • Header document format
  • Bug fixes

Note on version 1.0.2, 1.0.3, 1.0.4

Edited the readme file

Note 1.0.5

  • Fixed Header assembly (removing the last char)

Note 1.0.6

Hey, dudes. In this version, was implemented:

  • Auto-identification line (if none was defined on logger method)
  • Message header now containing name file and method { File.Method }
  • Bug fixes

Note 1.0.7

Dudes... Sorry for that, but, if You update to this version, the structure caller has changed. Don't stay anger with Me. Really sorry. But I do this changes to make once more easy to create and control the logger.

What's new here, not more than the bills:

  • Auto-identification file caller (You still can customize the document name)
  • Function structure, now accepting just the message
  • Fix auto-identification line to Linux/Unix systems
  • Bug fixes

Note 1.0.8

Lads... Today, one more update that:

  • Adition of S(Single-line) colorful logger of one-line

  • Adition of I(Inline) non-colorful logger of one-line

  • Adition of U(Unstyled) non-colorful logger of multi-line

  • Adition of P(Pure) non-colorful object logger of multi-line

  • Adition of ALL methods by its full names

    • l or log
    • e or error
    • s or singleLine
    • i or inline
    • u or unstyled
    • o or object
    • w or wrecked
    • p or pure
  • Make more clear the header of log

  • Optmize the custom features of command colors and attributes

  • General optimizations

  • Bug fixes