docs(guide): document script logging

This commit is contained in:
Elian Doran 2025-10-01 20:22:50 +03:00
parent 7cfebbabeb
commit 95b1c82ccb
No known key found for this signature in database
8 changed files with 362 additions and 281 deletions

File diff suppressed because one or more lines are too long

View File

@ -6,178 +6,173 @@ class="image">
<img style="aspect-ratio:1144/660;" src="Sharing_image.png" width="1144"
height="660">
</figure>
<h2>Features, interaction and limitations</h2>
<h2>Features, interaction and limitations</h2>
<ul>
<li data-list-item-id="eb3d8067f5cb94bac4a4a84183ef4ed02">Searching by note title.</li>
<li data-list-item-id="ed2b6bee8436ae78524bb348bab92b590">Automatic dark/light mode based on the user's browser settings.</li>
<li
data-list-item-id="e3d6e72b17bee26edd1cdf32f6622d1a8">Mobile-friendly layout, with sidebar.</li>
<li data-list-item-id="e82d45b6ad8b782bf44e765283f7648af">Collapsible tree with the same note icons as the application.</li>
<li
data-list-item-id="e9672befb64e973ce887f2a993f426f22">Customizable logo.</li>
<li data-list-item-id="e4aa50a784c9b83cdbe894eac6c4512e9">Toggle button for dark/light mode, which also stores the user preferences.</li>
<li
data-list-item-id="e0ba76ae1a1b97e38ca239ccc919ad562">Quick navigation buttons (previous and next note).</li>
<li data-list-item-id="e2a6c8a3de7eedaf5b344f136e298fd49">Displaying the date of the last update of the note.</li>
<li>Searching by note title.</li>
<li>Automatic dark/light mode based on the user's browser settings.</li>
<li>Mobile-friendly layout, with sidebar.</li>
<li>Collapsible tree with the same note icons as the application.</li>
<li>Customizable logo.</li>
<li>Toggle button for dark/light mode, which also stores the user preferences.</li>
<li>Quick navigation buttons (previous and next note).</li>
<li>Displaying the date of the last update of the note.</li>
</ul>
<h3>By note type</h3>
<figure class="table">
<table class="ck-table-resized">
<colgroup>
<col style="width:19.92%;">
<col style="width:41.66%;">
<col style="width:38.42%;">
</colgroup>
<thead>
<tr>
<th>&nbsp;</th>
<th>Supported features</th>
<th>Limitations</th>
</tr>
</thead>
<tbody>
<tr>
<th><a class="reference-link" href="#root/_help_iPIMuisry3hd">Text</a>
</th>
<td>
<ul>
<li data-list-item-id="e26b4ce9ba4e9dfe224d04e0f341925ed">Table of contents.</li>
<li data-list-item-id="e9707fdfa2c92d66690cf932f7e647253">Syntax highlight of code blocks, provided a language is selected (does
not work if “Auto-detected” is enabled).</li>
<li data-list-item-id="e84420a10c6d64bd107edb6e867c91d4b">Rendering for math equations.</li>
<li data-list-item-id="e10834dcd0619d77ae2e94d3695bedf58"><a href="#root/pOsGYCXsbNQG/KSZ04uQ2D1St/iPIMuisry3hd/_help_nBAXQFj20hS1">Including notes</a> (only
if the included notes are also shared).</li>
</ul>
</td>
<td>
<ul>
<li data-list-item-id="e41cc4139377f9f88d653d1eb8ca47bb4">Inline Mermaid diagrams are not rendered.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_6f9hih2hXXZk">Code</a>
</th>
<td>
<ul>
<li data-list-item-id="e291ae6d5130677b4c99f7c3bdbe974b4">Basic support (displaying the contents of the note in a monospace font).</li>
</ul>
</td>
<td>
<ul>
<li data-list-item-id="e0270680bbdd7a129306e61e11691e36d">No syntax highlight.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_m523cpzocqaD">Saved Search</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_iRwzGnHPzonm">Relation Map</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_bdUJEHsAPYQR">Note Map</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_HcABDtFCkbFN">Render Note</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>
</th>
<td>
<ul>
<li data-list-item-id="ea031e1d4149eb443ace756234490c5a4">The child notes are displayed in a fixed format.&nbsp;</li>
</ul>
</td>
<td>
<ul>
<li data-list-item-id="ea4a9d424aec2afbaecc07bbf64b7bebd">More advanced view types such as the calendar view are not supported.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_s1aBHPd79XYj">Mermaid Diagrams</a>
</th>
<td>
<ul>
<li data-list-item-id="e582d283f2b1b30cbe5ae35d8e01b2bf2">The diagram is displayed as a vector image.</li>
</ul>
</td>
<td>
<ul>
<li data-list-item-id="e33268686446e3c217077201bb5964364">No further interaction supported.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_grjYqerjn243">Canvas</a>
</th>
<td>
<ul>
<li data-list-item-id="e443dd0e97c30cb12c77e8906a71569ea">The diagram is displayed as a vector image.</li>
</ul>
</td>
<td>
<ul>
<li data-list-item-id="efe151ef3f3826c825416417525fb5fb2">No further interaction supported.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_1vHRoWCEjj0L">Web View</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_gBbsAeiuUxI5">Mind Map</a>
</th>
<td>The diagram is displayed as a vector image.</td>
<td>
<ul>
<li data-list-item-id="ed3b4fb473042f6e32b4502d4fa11a767">No further interaction supported.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_81SGnPGMk7Xc">Geo Map View</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_W8vYD3Q1zjCR">File</a>
</th>
<td>Basic interaction (downloading the file).</td>
<td>
<ul>
<li data-list-item-id="ed87e836a39d127ebcbb33e9e59045afb">No further interaction supported.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</figure>
<table class="ck-table-resized">
<colgroup>
<col style="width:19.92%;">
<col style="width:41.66%;">
<col style="width:38.42%;">
</colgroup>
<thead>
<tr>
<th>&nbsp;</th>
<th>Supported features</th>
<th>Limitations</th>
</tr>
</thead>
<tbody>
<tr>
<th><a class="reference-link" href="#root/_help_iPIMuisry3hd">Text</a>
</th>
<td>
<ul>
<li data-list-item-id="e26b4ce9ba4e9dfe224d04e0f341925ed">Table of contents.</li>
<li data-list-item-id="e9707fdfa2c92d66690cf932f7e647253">Syntax highlight of code blocks, provided a language is selected (does
not work if “Auto-detected” is enabled).</li>
<li data-list-item-id="e84420a10c6d64bd107edb6e867c91d4b">Rendering for math equations.</li>
<li data-list-item-id="e10834dcd0619d77ae2e94d3695bedf58"><a href="#root/_help_nBAXQFj20hS1">Including notes</a> (only if the included
notes are also shared).</li>
</ul>
</td>
<td>
<ul>
<li data-list-item-id="e41cc4139377f9f88d653d1eb8ca47bb4">Inline Mermaid diagrams are not rendered.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_6f9hih2hXXZk">Code</a>
</th>
<td>
<ul>
<li data-list-item-id="e291ae6d5130677b4c99f7c3bdbe974b4">Basic support (displaying the contents of the note in a monospace font).</li>
</ul>
</td>
<td>
<ul>
<li data-list-item-id="e0270680bbdd7a129306e61e11691e36d">No syntax highlight.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_m523cpzocqaD">Saved Search</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_iRwzGnHPzonm">Relation Map</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_bdUJEHsAPYQR">Note Map</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_HcABDtFCkbFN">Render Note</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>
</th>
<td>
<ul>
<li data-list-item-id="ea031e1d4149eb443ace756234490c5a4">The child notes are displayed in a fixed format.&nbsp;</li>
</ul>
</td>
<td>
<ul>
<li data-list-item-id="ea4a9d424aec2afbaecc07bbf64b7bebd">More advanced view types such as the calendar view are not supported.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_s1aBHPd79XYj">Mermaid Diagrams</a>
</th>
<td>
<ul>
<li data-list-item-id="e582d283f2b1b30cbe5ae35d8e01b2bf2">The diagram is displayed as a vector image.</li>
</ul>
</td>
<td>
<ul>
<li data-list-item-id="e33268686446e3c217077201bb5964364">No further interaction supported.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_grjYqerjn243">Canvas</a>
</th>
<td>
<ul>
<li data-list-item-id="e443dd0e97c30cb12c77e8906a71569ea">The diagram is displayed as a vector image.</li>
</ul>
</td>
<td>
<ul>
<li data-list-item-id="efe151ef3f3826c825416417525fb5fb2">No further interaction supported.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_1vHRoWCEjj0L">Web View</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_gBbsAeiuUxI5">Mind Map</a>
</th>
<td>The diagram is displayed as a vector image.</td>
<td>
<ul>
<li data-list-item-id="ed3b4fb473042f6e32b4502d4fa11a767">No further interaction supported.</li>
</ul>
</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_81SGnPGMk7Xc">Geo Map View</a>
</th>
<td>Not supported.</td>
<td>&nbsp;</td>
</tr>
<tr>
<th><a class="reference-link" href="#root/_help_W8vYD3Q1zjCR">File</a>
</th>
<td>Basic interaction (downloading the file).</td>
<td>
<ul>
<li data-list-item-id="ed87e836a39d127ebcbb33e9e59045afb">No further interaction supported.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>While the sharing feature is powerful, it has some limitations:</p>
<ul>
<li data-list-item-id="e4d030291f0f3baf41b533c9aab0958fa"><strong>Code Notes</strong>: No syntax highlighting.</li>
<li class="ck-list-marker-bold"
data-list-item-id="ec84705de13a1a2ce9f21bc5fd8b3ad64"><strong>Static Note Tree</strong>
<li><strong>Code Notes</strong>: No syntax highlighting.</li>
<li><strong>Static Note Tree</strong>
</li>
<li data-list-item-id="e5391374edc6fa023765af8802dae2d75"><strong>Protected Notes</strong>: Cannot be shared.</li>
<li data-list-item-id="e6556bb11a4c4bf2f4d44519a8c055634"><strong>Include Notes</strong>: Not supported.</li>
<li><strong>Protected Notes</strong>: Cannot be shared.</li>
<li><strong>Include Notes</strong>: Not supported.</li>
</ul>
<p>Some of these limitations may be addressed in future updates.</p>
<h2>Prerequisites</h2>
@ -186,7 +181,7 @@ class="image">
This is necessary because the notes will be hosted from the server.</p>
<h2>Sharing a note</h2>
<ol>
<li data-list-item-id="eb0acda67602064cf3393dd478527d708">
<li>
<p><strong>Enable Sharing</strong>: To share a note, toggle the <code>Shared</code> switch
within the note's interface. Once sharing is enabled, an URL will appear,
which you can click to access the shared note.</p>
@ -194,9 +189,11 @@ class="image">
<img src="Sharing_share-single-note.png" alt="Share Note">
</p>
</li>
<li data-list-item-id="e295548918d29695504a2356e807593e5"><strong>Access the Shared Note</strong>: The link provided will open the
note in your browser. If your server is not configured with a public IP,
the URL will refer to <code>localhost (127.0.0.1)</code>.</li>
<li>
<p><strong>Access the Shared Note</strong>: The link provided will open the
note in your browser. If your server is not configured with a public IP,
the URL will refer to <code>localhost (127.0.0.1)</code>.</p>
</li>
</ol>
<h2>Sharing a note subtree</h2>
<p>When you share a note, you actually share the entire subtree of notes
@ -222,13 +219,12 @@ class="image">
<p>The default design should be a good starting point, but you can customize
it using your own CSS:</p>
<ul>
<li data-list-item-id="e86cb1bab4a5f642720bad026d50f7742"><strong>Custom CSS</strong>: Link a CSS&nbsp;<a class="reference-link"
<li><strong>Custom CSS</strong>: Link a CSS&nbsp;<a class="reference-link"
href="#root/_help_6f9hih2hXXZk">Code</a>&nbsp;note to the shared page by
adding a <code>~shareCss</code> relation to the note. If you want this style
to apply to the entire subtree, make the label inheritable. You can hide
the CSS code note from the tree navigation by adding the <code>#shareHiddenFromTree</code> label.</li>
<li
data-list-item-id="ec911775f2f39d62f7a6a2ab762e3f773"><strong>Omitting Default CSS</strong>: For extensive styling changes,
<li><strong>Omitting Default CSS</strong>: For extensive styling changes,
use the <code>#shareOmitDefaultCss</code> label to avoid conflicts with Trilium's
<a
href="#root/_help_Wy267RK4M69c">default stylesheet</a>.</li>
@ -251,8 +247,8 @@ for (const attr of parentNote.attributes) {
This will change the URL to <code>http://domain.tld/share/highlighting</code>.</p>
<p><strong>Important</strong>:</p>
<ol>
<li data-list-item-id="e15a33a78ef6f36ad0aa99341387051b0">Ensure that aliases are unique.</li>
<li data-list-item-id="ed1ec56ed4f152f9adceacf6053ecaac2">Using slashes (<code>/</code>) within aliases to create subpaths is not
<li>Ensure that aliases are unique.</li>
<li>Using slashes (<code>/</code>) within aliases to create subpaths is not
supported.</li>
</ol>
<h3>Setting a custom favicon</h3>
@ -275,84 +271,83 @@ for (const attr of parentNote.attributes) {
When viewed, the list of shared roots will be displayed at the bottom of
the note.</p>
<h2>Attribute reference</h2>
<figure class="table">
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>shareHiddenFromTree</code>
</td>
<td>this note is hidden from left navigation tree, but still accessible with
its URL</td>
</tr>
<tr>
<td><code>shareExternalLink</code>
</td>
<td>note will act as a link to an external website in the share tree</td>
</tr>
<tr>
<td><code>shareAlias</code>
</td>
<td>define an alias using which the note will be available under <code>https://your_trilium_host/share/[your_alias]</code>
</td>
</tr>
<tr>
<td><code>shareOmitDefaultCss</code>
</td>
<td>default share page CSS will be omitted. Use when you make extensive styling
changes.</td>
</tr>
<tr>
<td><code>shareRoot</code>
</td>
<td>marks note which is served on /share root.</td>
</tr>
<tr>
<td><code>shareDescription</code>
</td>
<td>define text to be added to the HTML meta tag for description</td>
</tr>
<tr>
<td><code>shareRaw</code>
</td>
<td>Note will be served in its raw format, without HTML wrapper. See also&nbsp;
<a
class="reference-link" href="#root/_help_Qjt68inQ2bRj">Serving directly the content of a note</a>&nbsp;for an alternative method
without setting an attribute.</td>
</tr>
<tr>
<td><code>shareDisallowRobotIndexing</code>
</td>
<td>
<p>Indicates to web crawlers that the page should not be indexed of this
note by:</p>
<ul>
<li data-list-item-id="e6baa9f60bf59d085fd31aa2cce07a0e7">Setting the <code>X-Robots-Tag: noindex</code> HTTP header.</li>
<li data-list-item-id="ec0d067db136ef9794e4f1033405880b7">Setting the <code>noindex, follow</code> meta tag.</li>
</ul>
</td>
</tr>
<tr>
<td><code>shareCredentials</code>
</td>
<td>require credentials to access this shared note. Value is expected to be
in format <code>username:password</code>. Don't forget to make this inheritable
to apply to child-notes/images.</td>
</tr>
<tr>
<td><code>shareIndex</code>
</td>
<td>Note with this label will list all roots of shared notes.</td>
</tr>
</tbody>
</table>
</figure>
<h2>Credits</h2>
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>shareHiddenFromTree</code>
</td>
<td>this note is hidden from left navigation tree, but still accessible with
its URL</td>
</tr>
<tr>
<td><code>shareExternalLink</code>
</td>
<td>note will act as a link to an external website in the share tree</td>
</tr>
<tr>
<td><code>shareAlias</code>
</td>
<td>define an alias using which the note will be available under <code>https://your_trilium_host/share/[your_alias]</code>
</td>
</tr>
<tr>
<td><code>shareOmitDefaultCss</code>
</td>
<td>default share page CSS will be omitted. Use when you make extensive styling
changes.</td>
</tr>
<tr>
<td><code>shareRoot</code>
</td>
<td>marks note which is served on /share root.</td>
</tr>
<tr>
<td><code>shareDescription</code>
</td>
<td>define text to be added to the HTML meta tag for description</td>
</tr>
<tr>
<td><code>shareRaw</code>
</td>
<td>Note will be served in its raw format, without HTML wrapper. See also&nbsp;
<a
class="reference-link" href="#root/_help_Qjt68inQ2bRj">Serving directly the content of a note</a>&nbsp;for an alternative method
without setting an attribute.</td>
</tr>
<tr>
<td><code>shareDisallowRobotIndexing</code>
</td>
<td>
<p>Indicates to web crawlers that the page should not be indexed of this
note by:</p>
<ul>
<li data-list-item-id="e6baa9f60bf59d085fd31aa2cce07a0e7">Setting the <code>X-Robots-Tag: noindex</code> HTTP header.</li>
<li data-list-item-id="ec0d067db136ef9794e4f1033405880b7">Setting the <code>noindex, follow</code> meta tag.</li>
</ul>
</td>
</tr>
<tr>
<td><code>shareCredentials</code>
</td>
<td>require credentials to access this shared note. Value is expected to be
in format <code>username:password</code>. Don't forget to make this inheritable
to apply to child-notes/images.</td>
</tr>
<tr>
<td><code>shareIndex</code>
</td>
<td>Note with this label will list all roots of shared notes.</td>
</tr>
</tbody>
</table>
<h2>Credits</h2>
<p>Since v0.95.0, a new theme was introduced (and enabled by default) which
greatly improves the visual aspect of the Share feature, as well as its
functionality (such as mobile support, dark/light mode, collapsible tree,

View File

@ -7,9 +7,9 @@
<img src="Include Note_image.png">button. There is also a keyboard shortcut defined for it but it is not
allocated by default.</p>
<h2>Included notes in the share functionality</h2>
<p>If a <a href="#root/pOsGYCXsbNQG/tC7s2alapj8V/_help_R9pX4DGra2Vt">shared note</a> contains
one or more included notes, they will be displayed in the content of the
note as if they were part of the note itself.</p>
<p>If a <a href="#root/_help_R9pX4DGra2Vt">shared note</a> contains one or
more included notes, they will be displayed in the content of the note
as if they were part of the note itself.</p>
<p>For this to work, the included notes must also be shared, otherwise they
will not be shown. However, the included notes can still be hidden from
the note tree via <code>#shareHiddenFromTree</code>.</p>

View File

@ -0,0 +1,24 @@
<p>Both front-end and back-end notes can log messages for debugging.</p>
<h2>UI logging via <code>api.log</code></h2>
<figure class="image image_resized image-style-align-center" style="width:57.74%;">
<img style="aspect-ratio:749/545;" src="Logging_image.png" width="749"
height="545">
</figure>
<p>The API log feature integrates with the script editor and it displays
all the messages logged via <code>api.log</code>. This works for both back-end
and front-end scripts.</p>
<p>The API log panel will appear after executing a script that uses <code>api.log</code> and
it can be dismissed temporarily by pressing the close button in the top-right
of the panel.</p>
<p>Apart from strings, an object can be passed as well in which case it will
be pretty-formatted if possible (e.g. recursive objects are not supported).</p>
<h2>Console logging</h2>
<p>For logs that are not directly visible to the user, the standard <code>console.log</code> can
be used as well.</p>
<ul>
<li data-list-item-id="ec01fd8ccf51930dda1c2f707e78c0842">For front-end scripts, the log will be shown in the Developer Tools (also
known as Inspect).</li>
<li data-list-item-id="e62355c5371735daf1c436b4d65ba3549">For back-end scripts, the log will be shown in the server output while
running but <strong>will not</strong> be visible in the&nbsp;<a class="reference-link"
href="#root/pOsGYCXsbNQG/BgmBlOIl72jZ/qzNzp9LYQyPT/_help_bnyigUA2UK7s">Backend (server) logs</a>.</li>
</ul>

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -10367,122 +10367,129 @@
{
"type": "relation",
"name": "internalLink",
"value": "6f9hih2hXXZk",
"value": "nBAXQFj20hS1",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "m523cpzocqaD",
"value": "6f9hih2hXXZk",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "iRwzGnHPzonm",
"value": "m523cpzocqaD",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "bdUJEHsAPYQR",
"value": "iRwzGnHPzonm",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "HcABDtFCkbFN",
"value": "bdUJEHsAPYQR",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "GTwFsgaA0lCt",
"value": "HcABDtFCkbFN",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "s1aBHPd79XYj",
"value": "GTwFsgaA0lCt",
"isInheritable": false,
"position": 80
},
{
"type": "relation",
"name": "internalLink",
"value": "grjYqerjn243",
"value": "s1aBHPd79XYj",
"isInheritable": false,
"position": 90
},
{
"type": "relation",
"name": "internalLink",
"value": "1vHRoWCEjj0L",
"value": "grjYqerjn243",
"isInheritable": false,
"position": 100
},
{
"type": "relation",
"name": "internalLink",
"value": "gBbsAeiuUxI5",
"value": "1vHRoWCEjj0L",
"isInheritable": false,
"position": 110
},
{
"type": "relation",
"name": "internalLink",
"value": "81SGnPGMk7Xc",
"value": "gBbsAeiuUxI5",
"isInheritable": false,
"position": 120
},
{
"type": "relation",
"name": "internalLink",
"value": "W8vYD3Q1zjCR",
"value": "81SGnPGMk7Xc",
"isInheritable": false,
"position": 130
},
{
"type": "relation",
"name": "internalLink",
"value": "WOcw2SLH6tbX",
"value": "W8vYD3Q1zjCR",
"isInheritable": false,
"position": 140
},
{
"type": "relation",
"name": "internalLink",
"value": "x3i7MxGccDuM",
"value": "WOcw2SLH6tbX",
"isInheritable": false,
"position": 150
},
{
"type": "relation",
"name": "internalLink",
"value": "bwZpz2ajCEwO",
"value": "x3i7MxGccDuM",
"isInheritable": false,
"position": 160
},
{
"type": "relation",
"name": "internalLink",
"value": "Wy267RK4M69c",
"value": "bwZpz2ajCEwO",
"isInheritable": false,
"position": 170
},
{
"type": "relation",
"name": "internalLink",
"value": "Qjt68inQ2bRj",
"value": "Wy267RK4M69c",
"isInheritable": false,
"position": 180
},
{
"type": "relation",
"name": "internalLink",
"value": "Qjt68inQ2bRj",
"isInheritable": false,
"position": 190
},
{
"type": "label",
"name": "shareAlias",
@ -10496,13 +10503,6 @@
"value": "bx bx-share-alt",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "nBAXQFj20hS1",
"isInheritable": false,
"position": 190
}
],
"format": "markdown",
@ -13209,6 +13209,49 @@
"attachments": []
}
]
},
{
"isClone": false,
"noteId": "vElnKeDNPSVl",
"notePath": [
"pOsGYCXsbNQG",
"CdNpE2pqjmI6",
"vElnKeDNPSVl"
],
"title": "Logging",
"notePosition": 100,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "bnyigUA2UK7s",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-terminal",
"isInheritable": false,
"position": 20
}
],
"format": "markdown",
"dataFileName": "Logging.md",
"attachments": [
{
"attachmentId": "OFVZwVeITJOR",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Logging_image.png"
}
]
}
]
}

View File

@ -0,0 +1,19 @@
# Logging
Both front-end and back-end notes can log messages for debugging.
## UI logging via `api.log`
<figure class="image image_resized image-style-align-center" style="width:57.74%;"><img style="aspect-ratio:749/545;" src="Logging_image.png" width="749" height="545"></figure>
The API log feature integrates with the script editor and it displays all the messages logged via `api.log`. This works for both back-end and front-end scripts.
The API log panel will appear after executing a script that uses `api.log` and it can be dismissed temporarily by pressing the close button in the top-right of the panel.
Apart from strings, an object can be passed as well in which case it will be pretty-formatted if possible (e.g. recursive objects are not supported).
## Console logging
For logs that are not directly visible to the user, the standard `console.log` can be used as well.
* For front-end scripts, the log will be shown in the Developer Tools (also known as Inspect).
* For back-end scripts, the log will be shown in the server output while running but **will not** be visible in the <a class="reference-link" href="../Troubleshooting/Error%20logs/Backend%20(server)%20logs.md">Backend (server) logs</a>.

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB