This commit is contained in:
parent
f9d0469466
commit
0f4b82807e
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user