0.1.3 • Published 1 year ago

@nikolas.karinja/logger v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Logger

NPM Package

Console Messages Built Specifically For Your App

Developed by Nikolas Karinja

A very simple yet dynamic way of handling console logging. You can set specified parameters that describe your app and the location of where a log is contained, allowing for a sweet way to debug something. It's a small library that I built to cater my needs.

Installation

I only have the option for NPM at the moment.

npm

npm i --save @nikolas.karinja/logger

HTML Tag

<!-- CommonJS -->
<script src='node_modules/@nikolas.karinja/logger/build/build.cjs'></script>
<!-- ES Module -->
<script src='node_modules/@nikolas.karinja/logger/build/build.mjs' type='module'></script>

Script (CommonJS)

const Logger = require( '@nikolas.karinja/logger' )

Script (ES Module)

// Using parcel or another package manager

import * as Logger from '@nikolas.karinja/logger'

// Using default file system

import * as Logger from 'node_modules/@nikolas.karinja/logger/build/build.mjs'

Usage

  • Allows for simple yet customizable console logging.
  • Create different instances of Loggers to use in different parts of your app.
  • I will post documentation soon.

Example

I will post more examples and documentation soon. Here is an example of how to use the built-in functions and seperate class instances.

import * as Logger from '@nikolas.karinja/logger'

Logger.setup( { 
    appName            : 'My Package', 
    locationBackground : 'cyan' // css color
} )

Logger.log( 'Welcome!' ) // console.log
Logger.warn( 'Watch out...' ) // console.warn
Logger.error( 'Uh oh :(', { location: 'someFunction()' } ) // console.error

// seperate instance

const MyLogger = new Logger.Logger( {
    appName            : 'My App',
    appNameBackground  : 'blue', // css color
    locationForeground : 'white' // css color
} )

MyLogger.setup( { 
    appNameForeground : 'red', // css color
} )

MyLogger.log( 'Hey there!' )
MyLogger.warn( 'Yikes!', { location: 'anotherFunction()' } )
MyLogger.error( 'Oh no!' )