Giter Site home page Giter Site logo

logsplus's Introduction

LogsPlus

A module to help you log better in your Javascript and TypeScript projects.

Installing the module

Run npm install logsplus in your chosen command prompt.

Importing the module

To import the module in Javascript:

const Logger = require('logsplus')

And in TypeScript:

import Logger from 'logsplus'

Using the module

// To send a general log
Logger.log("This is a normal log!")

// To send an info log
Logger.info("This is an informational log.")

// To send a warning
Logger.warn("This is a warning.")

// To send an error
Logger.error("This is an error, you should check this out!")

The same goes for TypeScript, remember to replace "Logger" with whatever you initialised the module with.
You can also make the default console use this module so you don't have to import the module in every file:

console = Logger.linkConsole(console)

Note: This line of code only needs to go in your main file, because the console object syncs between files.
And then it's as simple as doing what you done before, just with the default console instead!

// To do a general log
console.log("This is a normal log!")

// To send an info log
console.info("This is an informational log.")

// To send a warning
console.warn("This is a warning.")

// To send an error
console.error("This is an error, you should check this out!")

Also, to get any of the original console functions, just do, for example, console.default.log!

Support & Feature Requests

This package is looking for feedback and ideas to help cover more use cases. If you have any ideas feel free to share them within the "suggestions" channel in the Commandcracker8's Development Discord server. You can also use the Issues Page of the Github repo for this package.

logsplus's People

Contributors

commandcracker8 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.