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

jtlog

v2.0.5

Published

JavascriptTypescriptLog (JTLog) is Log library.

Downloads

30

Readme

JTLog

Build Status

JavascriptTypescriptLog (JTLog) is Log library.

Features

  • Simple Console logging.
  • Record/Store console logs for a particular session, return it in an array.
  • 2 Modes for development and production (Won't be visible to users).
  • Switch between consoling and recording, or choose both.

Installation

npm i jtlog --save

Usage

Javascript

// Include the module
var JT = require('jtlog');

TypeScript

import { JTLog } from 'jtlog';
JTLog.log("start", "App Started");

General

// To start the module 
// appname will be replaced by your program/app name
JT.start("appname");

// To change configuration
// setConfig(NAME, VALUE)
// NAME: <string> List can be found in Configuration list
// VALUE: <any> New value you wish to set
JT.setConfig("allowLog",true);

// To get configuration value
JT.getConfig("allowLog"); // This will return true by default

// To log something in console
// log(TAG, MSG, STYLE)
// TAG: <string> To tag the message | List can be found below
// MSG: <any> you message, it can also be a object
// STYLE: <string> <optional> very basic css style works
JT.log('default',"App started", "color:black");

//
// We are using just one function to log, cause this will avoid error
// In case you add wrong tag, this won't be a problem.
//


// To get the array of log history/record 
let record: any = JT.getLogRecord();

Note: JT is a module variable, It will be different for you, as you assign it.

Configuration List

No | Name | Type | Description | ---|------|------|-------------| 1 | allowLog | Boolean | To decide if you wish to log or not 2 | allowRecording | Boolean | To allow recording of logs 3 | pageName | String | To set file name of current page we are on. 4 | appName | String | Name of app, it is set by user 5 | appStartTime | String | Time when app started

Tag List

No | Tag | Description3
---|------|------------| 1 | default | Normal log 2 | table | Print table 3 | warn | Print Warning 4 | info | Print Information 5 | start | Print Starting Heading 6 | call | Print when a function is called 7 | file | Print when a file is opened, also chances the fileName. 8 | error | Print a error

File Structure

JTLog
|
├── src
│   ├── index.d.ts
│   └── index.js
├── test
│   └── test.js
├── art/..
├── node_modules/...
├── index.ts
├── LICENSE
├── package.json
├── package-lock.json
├── README.md
└── tsconfig.json

Contribution

Feel free to contribute.

Licence

Copyright 2018 Raman Tehlan < [email protected] >

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.