Push dev work to master #2
|
@ -0,0 +1,13 @@
|
||||||
|
<a name="createLog"></a>
|
||||||
|
|
||||||
|
## createLog(label, filename) ⇒ <code>object</code>
|
||||||
|
createLog() - Returns a winston logger configured to service
|
||||||
|
|
||||||
|
**Kind**: global function
|
||||||
|
**Returns**: <code>object</code> - Winston logger
|
||||||
|
|
||||||
|
| Param | Type | Default | Description |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| label | <code>string</code> | | Label appearing on logger |
|
||||||
|
| filename | <code>string</code> | <code>null</code> | Optional file to write log to |
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const winston = require('winston')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* createLog() - Returns a winston logger configured to service
|
||||||
|
*
|
||||||
|
* @param {string} label Label appearing on logger
|
||||||
|
* @param {string} filename Optional file to write log to
|
||||||
|
* @returns {object} Winston logger
|
||||||
|
*/
|
||||||
|
function createLog (label, filename = null) {
|
||||||
|
const transports = [ new (winston.transports.Console)({ label : label }) ]
|
||||||
|
if (filename !== null) {
|
||||||
|
transports.push( new (winston.transports.File)({ label : label, filename : filename }) )
|
||||||
|
}
|
||||||
|
return new (winston.Logger)({
|
||||||
|
transports: transports
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = createLog
|
|
@ -9,6 +9,7 @@ const refresh = '/sbin/ifdown wlan0 && /sbin/ifup --force wlan0'
|
||||||
const iwlist = '/sbin/iwlist wlan0 scanning | grep "ESSID:"'
|
const iwlist = '/sbin/iwlist wlan0 scanning | grep "ESSID:"'
|
||||||
const iwgetid = '/sbin/iwgetid'
|
const iwgetid = '/sbin/iwgetid'
|
||||||
|
|
||||||
|
const log = require('../log')('wifi')
|
||||||
const exec = require('child_process').exec
|
const exec = require('child_process').exec
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue