0.0.0 • Published 6 years ago

xcontrol-logger v0.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

npm install --save xcontrol-logger

xcontrol-logger

A logger for xcontrol controllers

usage

Basic logging

import Logger from 'xcontrol-logger'
import Value from 'xcontrol/lib/models/Value'

const LoggedValue = Logger ( Value )

const value = new LoggedValue( 1 ) // console: 1
value.set(2) // console: 2

Custom logging

import Logger from 'xcontrol-logger'
import Value from 'xcontrol/lib/models/Value'

const MyLogger = Super => class extends Logger ( Super ) {
    log(nextStore){
        console.log('my log:')
        super.log(nextStore)
    }
}

const value = new ( MyLogger ( Value ))('hello') // console: my log: hello
value.set('new value') // console: my log: new value