https://github.com/thk2b/xcontrol-logger
A logger for xcontrol controllers
https://github.com/thk2b/xcontrol-logger
Last synced: 12 months ago
JSON representation
A logger for xcontrol controllers
- Host: GitHub
- URL: https://github.com/thk2b/xcontrol-logger
- Owner: thk2b
- License: mit
- Created: 2018-03-30T23:51:12.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-11T16:31:59.000Z (about 8 years ago)
- Last Synced: 2025-05-02T17:59:40.015Z (about 1 year ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
`npm install --save xcontrol-logger`
# xcontrol-logger
A logger for xcontrol controllers
# usage
Basic logging
```js
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
```js
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
```