smart-log

smart-log is very smart!

Usage no npm install needed!

<script type="module">
  import smartLog from 'https://cdn.skypack.dev/smart-log';
</script>

README

Smart-Log

var s = require('smart-log');

// simple
s('**** simple ****');
s('kt');
/*
**** simple ****
キタ━━━━(゚∀゚)━━━━!!!!
*/

// multi
s()('**** multi ****');
s('kt')('ktkr')('test')('good');
/*
**** multi ****
キタ━━━━(゚∀゚)━━━━!!!!
キタ(゚∀゚)コレ
test
( ̄ー ̄)bグッ!
*/

// chain
s()('**** chain ****');
s
.configure({
  kuma: '(* ̄(エ) ̄*)'
})
('kiri')
.log('kt')
.info('ok')
.warn('kuma')
.error('dame', 'dame');
/*
**** chain ****
( ー`дー´)キリッ
キタ━━━━(゚∀゚)━━━━!!!!
( ´∀`)bグッ!
(* ̄(エ) ̄*)
ダァメ 乂(゚Д゚三゚Д゚)乂 ダァメ dame
*/

// extend - node only
s()('**** extend ****')
.ex()
.info('kt', { a: { b: { c: { d: { e: 1 } } } } })
.ex(false)
( { a: { b: { c: { d: { e: 2 } } } } });
/*
**** extend ****
キタ━━━━(゚∀゚)━━━━!!!! { a: { b: { c: { d: { e: 1 } } } } }
{ a: { b: { c: [Object] } } }
*/

// activate and inactivate
s()('**** activate ****')
.inactivate()
.log('ok')
.activate()
.log('ok');
/*
**** activate ****
ok
( ´∀`)bグッ!
*/

// smart line
s()('**** smart line ****')
.log('4-')
.info('8+')
.warn('12=')
.error('10hoge');
.configure({
  'l': '48='
})
.log('l');
/*
**** smart line ****
----
++++++++
============
hogehogehogehogehogehogehogehogehogehoge
================================================
*/

// renewal
var sl = require('smart-log').SmartLog();
sl()('**** renewal ****');
sl('kuma');
/*
**** renewal ****
(´(ェ)`)
*/