5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-17 01:19:29 +08:00

Fix change in logging levels

This commit is contained in:
Lea Anthony 2020-10-13 07:49:47 +11:00
parent 51678afdc7
commit ff5e2862b8
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
6 changed files with 15 additions and 15 deletions

View File

@ -8,11 +8,11 @@ interface Store {
}
interface Level {
TRACE: 0,
DEBUG: 1,
INFO: 2,
WARNING: 3,
ERROR: 4,
TRACE: 1,
DEBUG: 2,
INFO: 3,
WARNING: 4,
ERROR: 5,
};
declare const wailsapp__runtime: {

View File

@ -135,9 +135,9 @@
}
},
"@wails/runtime": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@wails/runtime/-/runtime-1.0.3.tgz",
"integrity": "sha512-YfCItPdQ1Gk3AJWpEhnUKdL+eeod9lTtUV697G0q/Y6SnOc86B70S6osvyTCQcQmHVfNVhObpSdaosjWRShupg==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@wails/runtime/-/runtime-1.0.4.tgz",
"integrity": "sha512-x7marEg5nU//qUVRJAF9Hp0oyW75bevHv6jWAzoU977KQPoWtuCkxWm8B5X1u40rq1O0DHWy58R4CujwpewUTw==",
"dev": true
},
"alphanum-sort": {

View File

@ -11,7 +11,7 @@
"@rollup/plugin-commonjs": "^11.0.0",
"@rollup/plugin-node-resolve": "^7.0.0",
"@rollup/plugin-url": "^5.0.1",
"@wails/runtime": "^1.0.3",
"@wails/runtime": "^1.0.4",
"focus-visible": "^5.2.0",
"halfmoon": "^1.1.1",
"postcss": "^8.1.1",

View File

@ -13,7 +13,8 @@ runtime.System.OnThemeChange( (isDarkMode) => {
// LogLevel
// Create a svelte store for the logLevel and initialise with
// the loglevel stored in the Wails runtime
export let logLevel = writable(runtime.System.LogLevel.get());
const defaultLogLevel = runtime.System.LogLevel.get();
export let logLevel = writable(defaultLogLevel);
// Bind updates to the Wails store to the Svelte Store
runtime.System.LogLevel.subscribe( (newValue) => {

View File

@ -41,7 +41,7 @@
<div class="form-group">
<div>Select Log Method</div>
{#each loglevels as option, index}
{#if index === $logLevel}
{#if (index + 1) === $logLevel}
<span style="margin-top: 5px; height: 20px; display: inline-block;"><hr style="width: 270px;display: inline-block; vertical-align: middle; margin-right: 10px"/> Current Log Level </span>
{/if}
<div class="custom-radio">

View File

@ -11,15 +11,14 @@
var options = ["Trace", "Debug", "Info", "Warning", "Error"];
let isJs = false;
var id = "SetLogLevel";
let loglevelText = options[$logLevel];
let loglevelText = options[$logLevel-1];
$: setLogLevelMethod = isJs ? Log.SetLogLevel : backend.main.Logger.SetLogLevel;
function setLogLevel() {
let logLevelUpper = loglevelText.toUpperCase();
let logLevelNumber = Log.Level[logLevelUpper];
setLogLevelMethod(logLevelNumber);
logLevel.set(logLevelNumber);
let logLevelMethod = Log.Level[logLevelUpper];
setLogLevelMethod(logLevelMethod);
};
$: lang = isJs ? 'Javascript' : 'Go';