This commit is contained in:
Keith Paterson 2021-06-03 15:35:44 +02:00
parent f9d0469466
commit 0f4b82807e
2 changed files with 39 additions and 16 deletions

View File

@ -219,13 +219,27 @@
name: 'settings-panel',
components: { DirectorySelect, FileSelect },
props: [],
mounted () {
},
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: {
loggingChanged () {
this.scanStoreLogging = this.$store.state.Settings.settings.scanLogging === 1
},
flightgearDirectorySelect: function (flightgearDirectory) {
console.log(flightgearDirectory)
this.$store.commit('FLIGHTGEAR_DIRECTORY', flightgearDirectory)
@ -344,7 +358,7 @@
scanLogging: {
// getter
get: function () {
return this.$store.state.Settings.settings.scanLogging === 1
return this.scanStoreLogging
},
// setter
set: function (newValue) {

View File

@ -1,29 +1,38 @@
var util = require("util");
/* eslint-disable no-unused-vars */
var util = require('util');
const d = new Date();
const fName = 'scan_' + d.getFullYear()
+ d.getMonth()
+ d.getDay()
+ d.getHours()
+ d.getMinutes()
+ d.getSeconds()
+ d.getMilliseconds() + '.log';
const fName = 'scan_' + d.getFullYear() +
d.getMonth() +
d.getDay() +
d.getHours() +
d.getMinutes() +
d.getSeconds() +
d.getMilliseconds() + '.log';
var logStream = null;
var loggerInit = function (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 d = new Date();
if(logStream!==null) {
var d = new Date();
try {
if (logStream !== null) {
logStream.write(d.toUTCString() + '|' + level + ' | ' + msg + '\r\n');
}
if (o != undefined && logStream!==null) {
logStream.write( util.inspect(o,{depth: 2}) + '\r\n');
}
} catch (error) {
console.error('Logging not possible ' + error);
}
}