mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-10 05:02:36 +08:00
More Logging updates
This commit is contained in:
parent
6150010d17
commit
8988f29cea
32
v2/test/kitchensink/frontend/package-lock.json
generated
32
v2/test/kitchensink/frontend/package-lock.json
generated
@ -64,6 +64,17 @@
|
|||||||
"resolve": "^1.14.2"
|
"resolve": "^1.14.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@rollup/plugin-url": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rollup/plugin-url/-/plugin-url-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-/dO8Ic+vR9VtMkHjmFBWzISjX0iDwrB3vLg8sy4A7hxu2Uk0J09kAXbtku7gJb1fqVcJUIByFG5d/4sgNh1DvA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@rollup/pluginutils": "^3.0.4",
|
||||||
|
"make-dir": "^3.0.0",
|
||||||
|
"mime": "^2.4.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@rollup/pluginutils": {
|
"@rollup/pluginutils": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz",
|
||||||
@ -124,9 +135,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@wails/runtime": {
|
"@wails/runtime": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@wails/runtime/-/runtime-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@wails/runtime/-/runtime-1.0.3.tgz",
|
||||||
"integrity": "sha512-Af/VqrJz7so3t7tJT83ZxlL7AqgfHIfrIC+ZH80MQsNmcNmYiyB3rwxMxSWCqwmf2iDWUZx7hZ+XfytAPhH8PA==",
|
"integrity": "sha512-YfCItPdQ1Gk3AJWpEhnUKdL+eeod9lTtUV697G0q/Y6SnOc86B70S6osvyTCQcQmHVfNVhObpSdaosjWRShupg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"alphanum-sort": {
|
"alphanum-sort": {
|
||||||
@ -1395,6 +1406,15 @@
|
|||||||
"sourcemap-codec": "^1.4.4"
|
"sourcemap-codec": "^1.4.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"make-dir": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"semver": "^6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"mdn-data": {
|
"mdn-data": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz",
|
||||||
@ -3198,6 +3218,12 @@
|
|||||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
|
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"semver": {
|
||||||
|
"version": "6.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||||
|
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"serialize-javascript": {
|
"serialize-javascript": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-commonjs": "^11.0.0",
|
"@rollup/plugin-commonjs": "^11.0.0",
|
||||||
"@rollup/plugin-node-resolve": "^7.0.0",
|
"@rollup/plugin-node-resolve": "^7.0.0",
|
||||||
"@wails/runtime": "^1.0.2",
|
"@rollup/plugin-url": "^5.0.1",
|
||||||
|
"@wails/runtime": "^1.0.3",
|
||||||
"focus-visible": "^5.2.0",
|
"focus-visible": "^5.2.0",
|
||||||
"halfmoon": "^1.1.1",
|
"halfmoon": "^1.1.1",
|
||||||
"postcss": "^8.1.1",
|
"postcss": "^8.1.1",
|
||||||
|
@ -6,6 +6,7 @@ import { terser } from 'rollup-plugin-terser';
|
|||||||
import postcss from 'rollup-plugin-postcss';
|
import postcss from 'rollup-plugin-postcss';
|
||||||
import autoPreprocess from 'svelte-preprocess';
|
import autoPreprocess from 'svelte-preprocess';
|
||||||
import { string } from "rollup-plugin-string";
|
import { string } from "rollup-plugin-string";
|
||||||
|
import url from '@rollup/plugin-url';
|
||||||
|
|
||||||
const production = !process.env.ROLLUP_WATCH;
|
const production = !process.env.ROLLUP_WATCH;
|
||||||
|
|
||||||
@ -19,9 +20,18 @@ export default {
|
|||||||
},
|
},
|
||||||
onwarn: handleRollupWarning,
|
onwarn: handleRollupWarning,
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|
||||||
|
// Embed binary files
|
||||||
|
url({
|
||||||
|
include: ['**/*.woff', '**/*.woff2'],
|
||||||
|
limit: Infinity,
|
||||||
|
}),
|
||||||
|
|
||||||
|
// Embed text files
|
||||||
string({
|
string({
|
||||||
include: ["**/*.jsx","**/*.go"],
|
include: ["**/*.jsx","**/*.go"],
|
||||||
}),
|
}),
|
||||||
|
|
||||||
svelte({
|
svelte({
|
||||||
preprocess: autoPreprocess(),
|
preprocess: autoPreprocess(),
|
||||||
// enable run-time checks when not in production
|
// enable run-time checks when not in production
|
||||||
|
119
v2/test/kitchensink/frontend/src/App.css
Normal file
119
v2/test/kitchensink/frontend/src/App.css
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
|
||||||
|
:root {
|
||||||
|
--lm-base-body-bg-color: #0000;
|
||||||
|
--dm-base-body-bg-color: #0000;
|
||||||
|
--lm-sidebar-bg-color: #0000;
|
||||||
|
--dm-sidebar-bg-color: #0000;
|
||||||
|
--dm-sidebar-link-text-color: white;
|
||||||
|
--dm-sidebar-link-text-color-hover: rgb(255, 214, 0);
|
||||||
|
--lm-sidebar-link-text-color: black;
|
||||||
|
--lm-sidebar-link-text-color-hover: rgb(158, 158, 255);
|
||||||
|
|
||||||
|
--dm-sidebar-link-text-color-active: rgb(255, 214, 0);
|
||||||
|
--dm-sidebar-link-text-color-active-hover: rgb(255, 214, 0);
|
||||||
|
|
||||||
|
--sidebar-title-font-size: 1.75rem;
|
||||||
|
--sidebar-brand-font-size: 2.3rem;
|
||||||
|
|
||||||
|
--base-font-size: 1.6rem;
|
||||||
|
|
||||||
|
/* Switch */
|
||||||
|
--dm-switch-bg-color: rgb(28,173,213);
|
||||||
|
--lm-switch-bg-color: rgb(28,173,213);
|
||||||
|
--dm-switch-bg-color-checked: rgb(186,167,49);
|
||||||
|
--lm-switch-bg-color-checked: rgb(186,167,49);
|
||||||
|
--lm-switch-slider-bg-color: #FFF;
|
||||||
|
--dm-switch-slider-bg-color: #FFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background-color: rgba(128,128,128,.25);
|
||||||
|
border: 2px solid transparent;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-clip: padding-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(128,128,128,.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background-color: rgba(128,128,128,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-link {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhs {
|
||||||
|
background-color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inner-content {
|
||||||
|
position: absolute;
|
||||||
|
top: 40px;
|
||||||
|
bottom: 40px;
|
||||||
|
width: 99%;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-wrapper {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark-content-wrapper {
|
||||||
|
background-color: #25282c;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
.sidebar {
|
||||||
|
background-color: #0000;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.sidebar-brand {
|
||||||
|
padding-top: 35px;
|
||||||
|
padding-bottom: 25px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-menu {
|
||||||
|
background-color: #0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Credit: https://stackoverflow.com/a/4407335 */
|
||||||
|
.noselect {
|
||||||
|
cursor: default;
|
||||||
|
-webkit-touch-callout: none; /* iOS Safari */
|
||||||
|
-webkit-user-select: none; /* Safari */
|
||||||
|
-khtml-user-select: none; /* Konqueror HTML */
|
||||||
|
-moz-user-select: none; /* Old versions of Firefox */
|
||||||
|
-ms-user-select: none; /* Internet Explorer/Edge */
|
||||||
|
user-select: none; /* Non-prefixed version, currently
|
||||||
|
supported by Chrome, Edge, Opera and Firefox */
|
||||||
|
}
|
||||||
|
.allow-select {
|
||||||
|
-webkit-touch-callout: initial; /* iOS Safari */
|
||||||
|
-webkit-user-select: initial; /* Safari */
|
||||||
|
-khtml-user-select: initial; /* Konqueror HTML */
|
||||||
|
-moz-user-select: initial; /* Old versions of Firefox */
|
||||||
|
-ms-user-select: initial; /* Internet Explorer/Edge */
|
||||||
|
user-select: initial; /* Non-prefixed version, currently
|
||||||
|
supported by Chrome, Edge, Opera and Firefox */
|
||||||
|
}
|
||||||
|
|
||||||
|
.list {
|
||||||
|
margin-top: 2rem;
|
||||||
|
margin-left: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list li {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * {
|
||||||
|
font-family: 'Roboto';
|
||||||
|
} */
|
@ -68,119 +68,6 @@
|
|||||||
|
|
||||||
<style global>
|
<style global>
|
||||||
@import 'halfmoon/css/halfmoon-variables.min.css';
|
@import 'halfmoon/css/halfmoon-variables.min.css';
|
||||||
|
/* @import './assets/fonts/roboto.css'; */
|
||||||
:root {
|
@import './App.css';
|
||||||
--lm-base-body-bg-color: #0000;
|
|
||||||
--dm-base-body-bg-color: #0000;
|
|
||||||
--lm-sidebar-bg-color: #0000;
|
|
||||||
--dm-sidebar-bg-color: #0000;
|
|
||||||
--dm-sidebar-link-text-color: white;
|
|
||||||
--dm-sidebar-link-text-color-hover: rgb(255, 214, 0);
|
|
||||||
--lm-sidebar-link-text-color: black;
|
|
||||||
--lm-sidebar-link-text-color-hover: rgb(158, 158, 255);
|
|
||||||
|
|
||||||
--dm-sidebar-link-text-color-active: rgb(255, 214, 0);
|
|
||||||
--dm-sidebar-link-text-color-active-hover: rgb(255, 214, 0);
|
|
||||||
|
|
||||||
--sidebar-title-font-size: 1.75rem;
|
|
||||||
--sidebar-brand-font-size: 2.3rem;
|
|
||||||
|
|
||||||
/* Switch */
|
|
||||||
--dm-switch-bg-color: rgb(28,173,213);
|
|
||||||
--lm-switch-bg-color: rgb(28,173,213);
|
|
||||||
--dm-switch-bg-color-checked: rgb(186,167,49);
|
|
||||||
--lm-switch-bg-color-checked: rgb(186,167,49);
|
|
||||||
--lm-switch-slider-bg-color: #FFF;
|
|
||||||
--dm-switch-slider-bg-color: #FFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar {
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
|
||||||
background-color: rgba(128,128,128,.25);
|
|
||||||
border: 2px solid transparent;
|
|
||||||
border-radius: 10px;
|
|
||||||
background-clip: padding-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: rgba(128,128,128,.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
|
||||||
background-color: rgba(128,128,128,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-link {
|
|
||||||
font-weight: bold;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rhs {
|
|
||||||
background-color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inner-content {
|
|
||||||
position: absolute;
|
|
||||||
top: 40px;
|
|
||||||
bottom: 40px;
|
|
||||||
width: 99%;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-wrapper {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark-content-wrapper {
|
|
||||||
background-color: #25282c;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
.sidebar {
|
|
||||||
background-color: #0000;
|
|
||||||
} */
|
|
||||||
|
|
||||||
.sidebar-brand {
|
|
||||||
padding-top: 35px;
|
|
||||||
padding-bottom: 25px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-menu {
|
|
||||||
background-color: #0000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Credit: https://stackoverflow.com/a/4407335 */
|
|
||||||
.noselect {
|
|
||||||
cursor: default;
|
|
||||||
-webkit-touch-callout: none; /* iOS Safari */
|
|
||||||
-webkit-user-select: none; /* Safari */
|
|
||||||
-khtml-user-select: none; /* Konqueror HTML */
|
|
||||||
-moz-user-select: none; /* Old versions of Firefox */
|
|
||||||
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
||||||
user-select: none; /* Non-prefixed version, currently
|
|
||||||
supported by Chrome, Edge, Opera and Firefox */
|
|
||||||
}
|
|
||||||
.allow-select {
|
|
||||||
-webkit-touch-callout: initial; /* iOS Safari */
|
|
||||||
-webkit-user-select: initial; /* Safari */
|
|
||||||
-khtml-user-select: initial; /* Konqueror HTML */
|
|
||||||
-moz-user-select: initial; /* Old versions of Firefox */
|
|
||||||
-ms-user-select: initial; /* Internet Explorer/Edge */
|
|
||||||
user-select: initial; /* Non-prefixed version, currently
|
|
||||||
supported by Chrome, Edge, Opera and Firefox */
|
|
||||||
}
|
|
||||||
|
|
||||||
.list {
|
|
||||||
margin-top: 2rem;
|
|
||||||
margin-left: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list li {
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
8
v2/test/kitchensink/frontend/src/assets/fonts/roboto.css
Normal file
8
v2/test/kitchensink/frontend/src/assets/fonts/roboto.css
Normal file
File diff suppressed because one or more lines are too long
@ -50,19 +50,9 @@
|
|||||||
<div class="description">{description}</div>
|
<div class="description">{description}</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="example">
|
|
||||||
<div class="{showCode ? 'code-title-open' : 'code-title-closed'}" on:click="{toggleExample}" >
|
|
||||||
<span style="display: inline-block; width: 15px;">{showCode?'▼':'▶'}</span>
|
|
||||||
Example Code
|
|
||||||
</div>
|
|
||||||
{#if showCode}
|
|
||||||
<Highlight class="allow-select" language="{lang}" {code} style="max-height: 500px;"/>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="run">
|
<div class="run">
|
||||||
<div class="{showRun ? 'run-title-open' : 'run-title-closed'}" on:click="{toggleRun}">
|
<div class="{showRun ? 'run-title-open' : 'run-title-closed'}" on:click="{toggleRun}">
|
||||||
<span style="display: inline-block; width: 15px;">{showRun?'▼':'▶'}</span>
|
<span style="display: inline-block; width: 10px; font-size: 11px">{showRun?'▼':'▶'}</span>
|
||||||
Try Me!
|
Try Me!
|
||||||
</div>
|
</div>
|
||||||
{#if showRun}
|
{#if showRun}
|
||||||
@ -71,6 +61,15 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="example">
|
||||||
|
<div class="{showCode ? 'code-title-open' : 'code-title-closed'}" on:click="{toggleExample}" >
|
||||||
|
<span style="display: inline-block; width: 10px; font-size: 11px">{showCode?'▼':'▶'}</span>
|
||||||
|
Example Code
|
||||||
|
</div>
|
||||||
|
{#if showCode}
|
||||||
|
<Highlight class="allow-select" language="{lang}" {code} style="max-height: 500px;"/>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -80,23 +79,29 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
border-bottom: 1px solid #5555;
|
border-bottom: 1px solid #5555;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding-bottom: 10px;
|
align-items: center;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
padding-left: 5px;
|
||||||
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 1.75rem;
|
font-size: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code-title-open {
|
.code-title-open {
|
||||||
padding-top: 15px;
|
margin-top: 5px;
|
||||||
padding-bottom: 0;
|
margin-bottom: -5px;
|
||||||
|
padding-left: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-size: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code-title-closed {
|
.code-title-closed {
|
||||||
padding-top: 15px;
|
margin-top: 5px;
|
||||||
padding-bottom: 5px;
|
padding-left: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-size: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.run-content-dark {
|
.run-content-dark {
|
||||||
@ -110,16 +115,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.run-title-open {
|
.run-title-open {
|
||||||
margin-top: 15px;
|
margin-top: 5px;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 5px;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
|
padding-left: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-size: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.run-title-closed {
|
.run-title-closed {
|
||||||
margin-top: 15px;
|
margin-top: 5px;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 5px;
|
||||||
|
padding-left: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-size: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggle {
|
.toggle {
|
||||||
@ -129,8 +138,7 @@
|
|||||||
|
|
||||||
.example {
|
.example {
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
border-bottom: 1px solid #5555;
|
border-top: 1px solid #5555;
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-switch {
|
.custom-switch {
|
||||||
@ -142,7 +150,9 @@
|
|||||||
background-color: #3F3F4B;
|
background-color: #3F3F4B;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border: 1px solid #555;
|
border: 1px solid #555;
|
||||||
padding: 15px;
|
padding: 5px;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.codeblock-light {
|
.codeblock-light {
|
||||||
@ -150,6 +160,8 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.description {
|
.description {
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
<script>
|
||||||
|
import { darkMode } from '../Store';
|
||||||
|
|
||||||
|
import { Highlight } from "svelte-highlight";
|
||||||
|
import { go, javascript } from "svelte-highlight/languages";
|
||||||
|
|
||||||
|
// Default to Go
|
||||||
|
export let isJs = false;
|
||||||
|
|
||||||
|
// Calculate CSS to use
|
||||||
|
$: lang = isJs ? javascript : go;
|
||||||
|
|
||||||
|
// Calculate Code for code block
|
||||||
|
export let jsCode = "Hi from JS!";
|
||||||
|
export let goCode = "Hi from Go!";
|
||||||
|
$: code = isJs ? jsCode : goCode;
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div data-wails-no-drag class={$darkMode ? "codeblock" : "codeblock-light"}>
|
||||||
|
<Highlight class="allow-select" language="{lang}" {code} style="margin: -5px; max-height: 500px; font-size: 13px"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
.codeblock {
|
||||||
|
background-color: #3F3F4B;
|
||||||
|
border: 1px solid #555;
|
||||||
|
padding: 5px;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.codeblock-light {
|
||||||
|
background-color: #e5e5e5;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 5px;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
@ -1,6 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Log } from '@wails/runtime';
|
import { Log } from '@wails/runtime';
|
||||||
import CodeBlock from '../../../components/CodeBlock.svelte';
|
import CodeBlock from '../../../components/CodeBlock.svelte';
|
||||||
|
import CodeSnippet from '../../../components/CodeSnippet.svelte';
|
||||||
import jsCode from './code.jsx';
|
import jsCode from './code.jsx';
|
||||||
import goCode from './code.go';
|
import goCode from './code.go';
|
||||||
|
|
||||||
@ -28,13 +29,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: encodedMessage = message.replace(`"`, `“`);
|
||||||
|
$: testcodeJs = "import { runtime } from '@wails/runtime';\nruntime.Log." + loglevel + "(`" + encodedMessage + "`);";
|
||||||
|
$: testcodeGo = '// runtime is given through WailsInit()\nruntime.Log.' + loglevel + '("' + encodedMessage + '")';
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CodeBlock bind:isJs={isJs} {jsCode} {goCode} title="Logging" {id}>
|
<CodeBlock bind:isJs={isJs} {jsCode} {goCode} title="Logging" {id}>
|
||||||
<div class="logging-form">
|
<div class="logging-form">
|
||||||
<form data-wails-no-drag class="w-500 mw-full">
|
<form data-wails-no-drag class="mw-full">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Debug">Select Logging Level</label>
|
<label for="Debug">Select Log Method</label>
|
||||||
{#each loglevels as option, index}
|
{#each loglevels as option, index}
|
||||||
{#if index === $logLevel}
|
{#if index === $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>
|
<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>
|
||||||
@ -52,6 +57,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input class="btn btn-primary" type="button" on:click="{sendLogMessage}" value="Log using {lang} runtime">
|
<input class="btn btn-primary" type="button" on:click="{sendLogMessage}" value="Log using {lang} runtime">
|
||||||
|
|
||||||
|
<CodeSnippet bind:isJs={isJs} jsCode={testcodeJs} goCode={testcodeGo}></CodeSnippet>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</CodeBlock>
|
</CodeBlock>
|
||||||
|
@ -8,13 +8,14 @@ type MyStruct struct {
|
|||||||
|
|
||||||
func (l *MyStruct) WailsInit(runtime *wails.Runtime) error {
|
func (l *MyStruct) WailsInit(runtime *wails.Runtime) error {
|
||||||
|
|
||||||
|
message := "Hello World!"
|
||||||
runtime.Log.Print(message)
|
runtime.Log.Print(message)
|
||||||
runtime.Log.Trace(message)
|
// runtime.Log.Trace(message)
|
||||||
runtime.Log.Debug(message)
|
// runtime.Log.Debug(message)
|
||||||
runtime.Log.Info(message)
|
// runtime.Log.Info(message)
|
||||||
runtime.Log.Warning(message)
|
// runtime.Log.Warning(message)
|
||||||
runtime.Log.Error(message)
|
// runtime.Log.Error(message)
|
||||||
runtime.Log.Fatal(message)
|
// runtime.Log.Fatal(message)
|
||||||
|
|
||||||
l.runtime = runtime
|
l.runtime = runtime
|
||||||
return nil
|
return nil
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
Logs are only output if they are above or equal to the current log level. Example: If the current log level is
|
Logs are only output if they are above or equal to the current log level. Example: If the current log level is
|
||||||
<code>Info</code>, then <code>Trace</code> and <code>Debug</code> messages will be surpressed. <br/>
|
<code>Info</code>, then <code>Trace</code> and <code>Debug</code> messages will be surpressed. <br/><br/>
|
||||||
<code>Fatal</code> will log the message and then immediately exit the program.<br/>
|
<code>Fatal</code> will log the message and then immediately exit the program.<br/><br/>
|
||||||
<code>Print</code> will send a raw message to the log. You can use <code>Print</code> at any log level.<br/>
|
<code>Print</code> will send a raw message to the log regardless of log level.<br/><br/>
|
||||||
|
|
||||||
The default logger will log messages to the console in the following format:<br/>
|
The default logger will log messages to the console in the following format:<br/>
|
||||||
<FakeTerm>
|
<FakeTerm>
|
||||||
@ -32,13 +32,13 @@ INFO | I am an Info message
|
|||||||
ERROR | I am an Error message
|
ERROR | I am an Error message
|
||||||
WARN | I am a Warning message
|
WARN | I am a Warning message
|
||||||
</FakeTerm>
|
</FakeTerm>
|
||||||
|
<br/>
|
||||||
Custom loggers may be given to your Wails application. More details <Link href="https://www.google.com">here</Link>.
|
Custom loggers may be given to your Wails application. More details <Link href="https://www.google.com">here</Link>.
|
||||||
|
|
||||||
<div style="padding: 15px"></div>
|
<br/><br/>
|
||||||
|
|
||||||
<Log></Log>
|
<Log></Log>
|
||||||
<br/>
|
<br/><br/>
|
||||||
<SetLogLevel></SetLogLevel>
|
<SetLogLevel></SetLogLevel>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import CodeBlock from '../../../components/CodeBlock.svelte';
|
import CodeBlock from '../../../components/CodeBlock.svelte';
|
||||||
|
import CodeSnippet from '../../../components/CodeSnippet.svelte';
|
||||||
import { logLevel } from '../../../Store';
|
import { logLevel } from '../../../Store';
|
||||||
|
|
||||||
import { Log } from '@wails/runtime';
|
import { Log } from '@wails/runtime';
|
||||||
@ -23,11 +24,13 @@
|
|||||||
|
|
||||||
let description = `You can set the log level using Log.SetLogLevel(). It accepts a log level (number) but the log levels supported have been added to Log: Log.TRACE
|
let description = `You can set the log level using Log.SetLogLevel(). It accepts a log level (number) but the log levels supported have been added to Log: Log.TRACE
|
||||||
`;
|
`;
|
||||||
|
$: testcodeJs = "import { Log } from '@wails/runtime';\nLog.SetLogLevel(Log.Level." + loglevelText.toUpperCase() + ");";
|
||||||
|
$: testcodeGo = 'import "github.com/wailsapp/wails/v2/pkg/logger"\n\n// runtime is given through WailsInit()\nruntime.Log.SetLogLevel(logger.' + loglevelText.toUpperCase() + ')';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CodeBlock bind:isJs={isJs} {jsCode} {goCode} title="SetLogLevel" {id} {description}>
|
<CodeBlock bind:isJs={isJs} {jsCode} {goCode} title="SetLogLevel" {id} {description}>
|
||||||
<div class="logging-form">
|
<div class="logging-form">
|
||||||
<form data-wails-no-drag class="w-500 mw-full">
|
<form data-wails-no-drag class="mw-full">
|
||||||
<!-- Radio -->
|
<!-- Radio -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Debug">Select Logging Level</label>
|
<label for="Debug">Select Logging Level</label>
|
||||||
@ -38,6 +41,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
<CodeSnippet bind:isJs={isJs} jsCode={testcodeJs} goCode={testcodeGo}></CodeSnippet>
|
||||||
<input class="btn btn-primary" type="button" on:click="{setLogLevel}" value="SetLogLevel using {lang} runtime">
|
<input class="btn btn-primary" type="button" on:click="{setLogLevel}" value="SetLogLevel using {lang} runtime">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
// SET LOG LEVEL
|
import (
|
||||||
|
wails "github.com/wailsapp/wails/v2"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/logger"
|
||||||
|
)
|
||||||
|
|
||||||
import wails "github.com/wailsapp/wails/v2"
|
// Logger struct
|
||||||
|
type Logger struct {
|
||||||
type MyStruct struct {
|
|
||||||
runtime *wails.Runtime
|
runtime *wails.Runtime
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *MyStruct) WailsInit(runtime *wails.Runtime) error {
|
func (l *Logger) WailsInit(runtime *wails.Runtime) error {
|
||||||
|
|
||||||
runtime.Log.Print(message)
|
runtime.Log.SetLogLevel(logger.TRACE)
|
||||||
runtime.Log.Trace(message)
|
// runtime.Log.SetLogLevel(logger.DEBUG)
|
||||||
runtime.Log.Debug(message)
|
// runtime.Log.SetLogLevel(logger.INFO)
|
||||||
runtime.Log.Info(message)
|
// runtime.Log.SetLogLevel(logger.WARNING)
|
||||||
runtime.Log.Warning(message)
|
// runtime.Log.SetLogLevel(logger.ERROR)
|
||||||
runtime.Log.Error(message)
|
|
||||||
runtime.Log.Fatal(message)
|
|
||||||
|
|
||||||
l.runtime = runtime
|
l.runtime = runtime
|
||||||
return nil
|
return nil
|
||||||
|
@ -1,20 +1,9 @@
|
|||||||
import { Log } from '@wails/runtime';
|
import { Log } from '@wails/runtime';
|
||||||
|
|
||||||
|
function setLogLevel() {
|
||||||
// SET LOG LEVEL
|
Log.SetLogLevel(Log.Level.TRACE);
|
||||||
|
// Log.SetLogLevel(Log.Level.DEBUG);
|
||||||
function doSomeOperation() {
|
// Log.SetLogLevel(Log.Level.INFO);
|
||||||
// Do things
|
// Log.SetLogLevel(Log.Level.WARNING);
|
||||||
let value = doSomething();
|
// Log.SetLogLevel(Log.Level.ERROR);
|
||||||
Log.Print("A raw message");
|
|
||||||
Log.Trace("I got: " + value);
|
|
||||||
Log.Debug("A debug message");
|
|
||||||
Log.Info("An Info message");
|
|
||||||
Log.Warning("A Warning message");
|
|
||||||
Log.Error("An Error message");
|
|
||||||
}
|
|
||||||
|
|
||||||
function abort() {
|
|
||||||
// Do some things
|
|
||||||
Log.Fatal("I accidentally the whole application!");
|
|
||||||
}
|
}
|
@ -16,8 +16,6 @@ func main() {
|
|||||||
Height: 768,
|
Height: 768,
|
||||||
MinWidth: 800,
|
MinWidth: 800,
|
||||||
MinHeight: 600,
|
MinHeight: 600,
|
||||||
MaxWidth: 1400,
|
|
||||||
MaxHeight: 800,
|
|
||||||
Mac: &mac.Options{
|
Mac: &mac.Options{
|
||||||
WebviewIsTransparent: true,
|
WebviewIsTransparent: true,
|
||||||
WindowBackgroundIsTranslucent: true,
|
WindowBackgroundIsTranslucent: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user