1.3.3 • Published 4 years ago

@ajar/marker v1.3.3

Weekly downloads
19
License
MIT
Repository
github
Last release
4 years ago

marker marker jest jest

Marker

A simple color logging utility for your node.js console.

Marker

installation

npm i @ajar/marker

Features

  1. colored logs - by level, level shorthand or explicit colors
  2. prefix logs with file name and line number
  3. prints complex objects
  4. smart error logs -

    logs error message and stack
    ignores node_modules and node internals to focus on your own code

CommonJS

const marker = require('@ajar/marker'); 

ES6 modules

import marker from '@ajar/marker'; 

Usage

marker.info('hello','marker'); 

Examples

//by levels  

marker.verbose('verbose','is explicit');
marker.debug('debug','is common');
marker.info('info','is trivial');  
marker.warn('warn','is important');  
marker.err('err','is critical'); 

//by levels shorthand

marker.v('v','is short for verbose');    
marker.d('d','is short for debug');     
marker.i('i','is short for info');     
marker.w('w','is short for warn');     
marker.e('e','is short for err');  

//by color names

marker.blue('blue','ocean');       
marker.magenta('magenta','is lighter then purple');    
marker.cyan('cyan','is lighter then blue');       
marker.green('green','peace');      
marker.yellow('yellow','mellow');     
marker.red('red','tape');        
   
// .obj()
const complex_object = {
    one:1,
    two:2,
    internal:{
        a:'first',
        b:'second',
        nested:{
            key:'value',
            some:'thing',
            fruits:['apple','orange','banana'],
            types:[{str:'one',int:2,bool:false,empty:null}]
        }
    },
    three:3,
    four:4
}
/**
 * Use .obj() to log complex objects
 * @param { Object } obj - the Object to log 
 * @param { string } label - optional label 
 */
marker.obj(complex_object,'This is a complex_object');

/**
 * use .error() to log errors
 * @param { Error } - an Error object to log
 */
try{
    define('is not defind')
}catch(err){
    marker.error(err)
}

Example output

@infinitebrahmanuniverse/nolb-_aj@everything-registry/sub-chunk-37@kolomiytsev/timescript@xomute/timescript@dorinelromeo/slugger@cocoseluldemunte/workspace@demonaft/timescript@coursenode/slugger@dorbiren/blue_bird_ts@dorbiren/slugger@shmulik010/timescriptts-swc-node-starterts-esm-starter@amitole/slugger@amitsrapyd/promise@amitsrapyd/slugger@antifreez/slugger@asafjonathan/slugger@anael5222/slugger@avivz_rapyd/slugger@avivz_rapyd/ts-promises-methods@avitallange/ex2@avitalva/slugger@avitalva/ts-promises-async@asryab/timescript@alexandravo/slugger@ajar/timescript@ajar/yavetz@ajar/async@ajar/slug@ajar/slugerion@ajar/slugger888@ajar/sluggerish@ajar/sluggio@ajar/sluggr@ajar/slugnation@ajar/swiss-utils2@alp2003/slugger@baddonic/timescript@bakbuk/ts-promises@azulaynaama90/slugger@barbuvlad91/slugger@amaliapopescu/slugger@bialik100/mypackages@chshum/npm_stuff@chekayufor/slugger@13pycm/timescript@1liornatan/timescript@adam-browning/slugger@__iklotz__/slugger@abcdabcd/slugger@daniela_ghica89/slugger@danielaz/timescript@danstan01/npmpackage@feldum/npm@dysco76/timescript@guy.katchka/slugger@guyyomtov/timepackage@grinvald.alexander/slugger@hezibe/slugger@eitanal/slugger@eliazu/slugger@eldarnegrin/slugger@ellabenatia/refuctor_promises@ellabenatia/slugger@elramv/slugger@elramv/typescript_project@gabriela993/slugger@gal-barkan/npm-tutorial@gal-barkan/promises-package@galbazadka/workspace@galg/slug@ekabelly/slugger@eliran0220/promises_npm@eliran0220/slugger@elitwina/slugger@frogety/slagger@giladrozmarin/slugger@gideonsh/promises@gideonsh/slugger@gramaradu/slugger@ladlad/slugger@kupernik/slugger@landau07/landau@kondrat7878/slugger@lizelkind/slagger@kmosh/timescript@liavv/slugger@liberwoman/promises@liberwoman/slugger@liberwoman/ts-swc-node-starter@itaytal/slugger@lirando/slugger@lironash/timescript@linoyboaron/slugger@linoyboaron/tsmodule@macrolet/timescript@michelle.chocron/slugger@mpmisha/slugger2.0@matanp/slugger
1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.15

6 years ago

1.1.14

6 years ago

1.1.13

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago