This commit is contained in:
parent
f9d0469466
commit
0f4b82807e
@ -219,13 +219,27 @@
|
|||||||
name: 'settings-panel',
|
name: 'settings-panel',
|
||||||
components: { DirectorySelect, FileSelect },
|
components: { DirectorySelect, FileSelect },
|
||||||
props: [],
|
props: [],
|
||||||
mounted () {
|
|
||||||
},
|
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
return { ok: true, activeName: '0' }
|
return { ok: true, activeName: '0', scanStoreLogging: false }
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
console.debug('Mount')
|
||||||
|
this.$store.watch(
|
||||||
|
function (state) {
|
||||||
|
console.debug('Mount ' + JSON.stringify(state))
|
||||||
|
return state.Settings.settings
|
||||||
|
},
|
||||||
|
() => { this.loggingChanged() }
|
||||||
|
,
|
||||||
|
{
|
||||||
|
deep: true // add this if u need to watch object properties change etc.
|
||||||
|
}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
loggingChanged () {
|
||||||
|
this.scanStoreLogging = this.$store.state.Settings.settings.scanLogging === 1
|
||||||
|
},
|
||||||
flightgearDirectorySelect: function (flightgearDirectory) {
|
flightgearDirectorySelect: function (flightgearDirectory) {
|
||||||
console.log(flightgearDirectory)
|
console.log(flightgearDirectory)
|
||||||
this.$store.commit('FLIGHTGEAR_DIRECTORY', flightgearDirectory)
|
this.$store.commit('FLIGHTGEAR_DIRECTORY', flightgearDirectory)
|
||||||
@ -344,7 +358,7 @@
|
|||||||
scanLogging: {
|
scanLogging: {
|
||||||
// getter
|
// getter
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$store.state.Settings.settings.scanLogging === 1
|
return this.scanStoreLogging
|
||||||
},
|
},
|
||||||
// setter
|
// setter
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
|
@ -1,29 +1,38 @@
|
|||||||
var util = require("util");
|
/* eslint-disable no-unused-vars */
|
||||||
|
var util = require('util');
|
||||||
|
|
||||||
const d = new Date();
|
const d = new Date();
|
||||||
|
|
||||||
const fName = 'scan_' + d.getFullYear()
|
const fName = 'scan_' + d.getFullYear() +
|
||||||
+ d.getMonth()
|
d.getMonth() +
|
||||||
+ d.getDay()
|
d.getDay() +
|
||||||
+ d.getHours()
|
d.getHours() +
|
||||||
+ d.getMinutes()
|
d.getMinutes() +
|
||||||
+ d.getSeconds()
|
d.getSeconds() +
|
||||||
+ d.getMilliseconds() + '.log';
|
d.getMilliseconds() + '.log';
|
||||||
|
|
||||||
var logStream = null;
|
var logStream = null;
|
||||||
|
|
||||||
var loggerInit = function (logging) {
|
var loggerInit = function (logging) {
|
||||||
if (logging) {
|
if (logging) {
|
||||||
logStream = require('fs').createWriteStream( fName, {autoClose: true});
|
try {
|
||||||
|
logStream = require('fs').createWriteStream( fName, {autoClose: true});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Logging not possible ' + error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var logger = function (level, msg, o) {
|
var logger = function (level, msg, o) {
|
||||||
var d = new Date();
|
var d = new Date();
|
||||||
if(logStream!==null) {
|
try {
|
||||||
|
if (logStream !== null) {
|
||||||
logStream.write(d.toUTCString() + '|' + level + ' | ' + msg + '\r\n');
|
logStream.write(d.toUTCString() + '|' + level + ' | ' + msg + '\r\n');
|
||||||
}
|
}
|
||||||
if (o != undefined && logStream!==null) {
|
if (o != undefined && logStream!==null) {
|
||||||
logStream.write( util.inspect(o,{depth: 2}) + '\r\n');
|
logStream.write( util.inspect(o,{depth: 2}) + '\r\n');
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Logging not possible ' + error);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user