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" <img style="aspect-ratio:1144/660;" src="Sharing_image.png" width="1144"
height="660"> height="660">
</figure> </figure>
<h2>Features, interaction and limitations</h2>
<h2>Features, interaction and limitations</h2>
<ul> <ul>
<li data-list-item-id="eb3d8067f5cb94bac4a4a84183ef4ed02">Searching by note title.</li> <li>Searching by note title.</li>
<li data-list-item-id="ed2b6bee8436ae78524bb348bab92b590">Automatic dark/light mode based on the user's browser settings.</li> <li>Automatic dark/light mode based on the user's browser settings.</li>
<li <li>Mobile-friendly layout, with sidebar.</li>
data-list-item-id="e3d6e72b17bee26edd1cdf32f6622d1a8">Mobile-friendly layout, with sidebar.</li> <li>Collapsible tree with the same note icons as the application.</li>
<li data-list-item-id="e82d45b6ad8b782bf44e765283f7648af">Collapsible tree with the same note icons as the application.</li> <li>Customizable logo.</li>
<li <li>Toggle button for dark/light mode, which also stores the user preferences.</li>
data-list-item-id="e9672befb64e973ce887f2a993f426f22">Customizable logo.</li> <li>Quick navigation buttons (previous and next note).</li>
<li data-list-item-id="e4aa50a784c9b83cdbe894eac6c4512e9">Toggle button for dark/light mode, which also stores the user preferences.</li> <li>Displaying the date of the last update of the note.</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>
</ul> </ul>
<h3>By note type</h3> <h3>By note type</h3>
<figure class="table"> <table class="ck-table-resized">
<table class="ck-table-resized"> <colgroup>
<colgroup> <col style="width:19.92%;">
<col style="width:19.92%;"> <col style="width:41.66%;">
<col style="width:41.66%;"> <col style="width:38.42%;">
<col style="width:38.42%;"> </colgroup>
</colgroup> <thead>
<thead> <tr>
<tr> <th>&nbsp;</th>
<th>&nbsp;</th> <th>Supported features</th>
<th>Supported features</th> <th>Limitations</th>
<th>Limitations</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> <tr>
<tr> <th><a class="reference-link" href="#root/_help_iPIMuisry3hd">Text</a>
<th><a class="reference-link" href="#root/_help_iPIMuisry3hd">Text</a> </th>
</th> <td>
<td> <ul>
<ul> <li data-list-item-id="e26b4ce9ba4e9dfe224d04e0f341925ed">Table of contents.</li>
<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
<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>
not work if “Auto-detected” is enabled).</li> <li data-list-item-id="e84420a10c6d64bd107edb6e867c91d4b">Rendering for math equations.</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
<li data-list-item-id="e10834dcd0619d77ae2e94d3695bedf58"><a href="#root/pOsGYCXsbNQG/KSZ04uQ2D1St/iPIMuisry3hd/_help_nBAXQFj20hS1">Including notes</a> (only notes are also shared).</li>
if the included notes are also shared).</li> </ul>
</ul> </td>
</td> <td>
<td> <ul>
<ul> <li data-list-item-id="e41cc4139377f9f88d653d1eb8ca47bb4">Inline Mermaid diagrams are not rendered.</li>
<li data-list-item-id="e41cc4139377f9f88d653d1eb8ca47bb4">Inline Mermaid diagrams are not rendered.</li> </ul>
</ul> </td>
</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_6f9hih2hXXZk">Code</a>
<th><a class="reference-link" href="#root/_help_6f9hih2hXXZk">Code</a> </th>
</th> <td>
<td> <ul>
<ul> <li data-list-item-id="e291ae6d5130677b4c99f7c3bdbe974b4">Basic support (displaying the contents of the note in a monospace font).</li>
<li data-list-item-id="e291ae6d5130677b4c99f7c3bdbe974b4">Basic support (displaying the contents of the note in a monospace font).</li> </ul>
</ul> </td>
</td> <td>
<td> <ul>
<ul> <li data-list-item-id="e0270680bbdd7a129306e61e11691e36d">No syntax highlight.</li>
<li data-list-item-id="e0270680bbdd7a129306e61e11691e36d">No syntax highlight.</li> </ul>
</ul> </td>
</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_m523cpzocqaD">Saved Search</a>
<th><a class="reference-link" href="#root/_help_m523cpzocqaD">Saved Search</a> </th>
</th> <td>Not supported.</td>
<td>Not supported.</td> <td>&nbsp;</td>
<td>&nbsp;</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_iRwzGnHPzonm">Relation Map</a>
<th><a class="reference-link" href="#root/_help_iRwzGnHPzonm">Relation Map</a> </th>
</th> <td>Not supported.</td>
<td>Not supported.</td> <td>&nbsp;</td>
<td>&nbsp;</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_bdUJEHsAPYQR">Note Map</a>
<th><a class="reference-link" href="#root/_help_bdUJEHsAPYQR">Note Map</a> </th>
</th> <td>Not supported.</td>
<td>Not supported.</td> <td>&nbsp;</td>
<td>&nbsp;</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_HcABDtFCkbFN">Render Note</a>
<th><a class="reference-link" href="#root/_help_HcABDtFCkbFN">Render Note</a> </th>
</th> <td>Not supported.</td>
<td>Not supported.</td> <td>&nbsp;</td>
<td>&nbsp;</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>
<th><a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a> </th>
</th> <td>
<td> <ul>
<ul> <li data-list-item-id="ea031e1d4149eb443ace756234490c5a4">The child notes are displayed in a fixed format.&nbsp;</li>
<li data-list-item-id="ea031e1d4149eb443ace756234490c5a4">The child notes are displayed in a fixed format.&nbsp;</li> </ul>
</ul> </td>
</td> <td>
<td> <ul>
<ul> <li data-list-item-id="ea4a9d424aec2afbaecc07bbf64b7bebd">More advanced view types such as the calendar view are not supported.</li>
<li data-list-item-id="ea4a9d424aec2afbaecc07bbf64b7bebd">More advanced view types such as the calendar view are not supported.</li> </ul>
</ul> </td>
</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_s1aBHPd79XYj">Mermaid Diagrams</a>
<th><a class="reference-link" href="#root/_help_s1aBHPd79XYj">Mermaid Diagrams</a> </th>
</th> <td>
<td> <ul>
<ul> <li data-list-item-id="e582d283f2b1b30cbe5ae35d8e01b2bf2">The diagram is displayed as a vector image.</li>
<li data-list-item-id="e582d283f2b1b30cbe5ae35d8e01b2bf2">The diagram is displayed as a vector image.</li> </ul>
</ul> </td>
</td> <td>
<td> <ul>
<ul> <li data-list-item-id="e33268686446e3c217077201bb5964364">No further interaction supported.</li>
<li data-list-item-id="e33268686446e3c217077201bb5964364">No further interaction supported.</li> </ul>
</ul> </td>
</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_grjYqerjn243">Canvas</a>
<th><a class="reference-link" href="#root/_help_grjYqerjn243">Canvas</a> </th>
</th> <td>
<td> <ul>
<ul> <li data-list-item-id="e443dd0e97c30cb12c77e8906a71569ea">The diagram is displayed as a vector image.</li>
<li data-list-item-id="e443dd0e97c30cb12c77e8906a71569ea">The diagram is displayed as a vector image.</li> </ul>
</ul> </td>
</td> <td>
<td> <ul>
<ul> <li data-list-item-id="efe151ef3f3826c825416417525fb5fb2">No further interaction supported.</li>
<li data-list-item-id="efe151ef3f3826c825416417525fb5fb2">No further interaction supported.</li> </ul>
</ul> </td>
</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_1vHRoWCEjj0L">Web View</a>
<th><a class="reference-link" href="#root/_help_1vHRoWCEjj0L">Web View</a> </th>
</th> <td>Not supported.</td>
<td>Not supported.</td> <td>&nbsp;</td>
<td>&nbsp;</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_gBbsAeiuUxI5">Mind Map</a>
<th><a class="reference-link" href="#root/_help_gBbsAeiuUxI5">Mind Map</a> </th>
</th> <td>The diagram is displayed as a vector image.</td>
<td>The diagram is displayed as a vector image.</td> <td>
<td> <ul>
<ul> <li data-list-item-id="ed3b4fb473042f6e32b4502d4fa11a767">No further interaction supported.</li>
<li data-list-item-id="ed3b4fb473042f6e32b4502d4fa11a767">No further interaction supported.</li> </ul>
</ul> </td>
</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_81SGnPGMk7Xc">Geo Map View</a>
<th><a class="reference-link" href="#root/_help_81SGnPGMk7Xc">Geo Map View</a> </th>
</th> <td>Not supported.</td>
<td>Not supported.</td> <td>&nbsp;</td>
<td>&nbsp;</td> </tr>
</tr> <tr>
<tr> <th><a class="reference-link" href="#root/_help_W8vYD3Q1zjCR">File</a>
<th><a class="reference-link" href="#root/_help_W8vYD3Q1zjCR">File</a> </th>
</th> <td>Basic interaction (downloading the file).</td>
<td>Basic interaction (downloading the file).</td> <td>
<td> <ul>
<ul> <li data-list-item-id="ed87e836a39d127ebcbb33e9e59045afb">No further interaction supported.</li>
<li data-list-item-id="ed87e836a39d127ebcbb33e9e59045afb">No further interaction supported.</li> </ul>
</ul> </td>
</td> </tr>
</tr> </tbody>
</tbody> </table>
</table>
</figure>
<p>While the sharing feature is powerful, it has some limitations:</p> <p>While the sharing feature is powerful, it has some limitations:</p>
<ul> <ul>
<li data-list-item-id="e4d030291f0f3baf41b533c9aab0958fa"><strong>Code Notes</strong>: No syntax highlighting.</li> <li><strong>Code Notes</strong>: No syntax highlighting.</li>
<li class="ck-list-marker-bold" <li><strong>Static Note Tree</strong>
data-list-item-id="ec84705de13a1a2ce9f21bc5fd8b3ad64"><strong>Static Note Tree</strong>
</li> </li>
<li data-list-item-id="e5391374edc6fa023765af8802dae2d75"><strong>Protected Notes</strong>: Cannot be shared.</li> <li><strong>Protected Notes</strong>: Cannot be shared.</li>
<li data-list-item-id="e6556bb11a4c4bf2f4d44519a8c055634"><strong>Include Notes</strong>: Not supported.</li> <li><strong>Include Notes</strong>: Not supported.</li>
</ul> </ul>
<p>Some of these limitations may be addressed in future updates.</p> <p>Some of these limitations may be addressed in future updates.</p>
<h2>Prerequisites</h2> <h2>Prerequisites</h2>
@ -186,7 +181,7 @@ class="image">
This is necessary because the notes will be hosted from the server.</p> This is necessary because the notes will be hosted from the server.</p>
<h2>Sharing a note</h2> <h2>Sharing a note</h2>
<ol> <ol>
<li data-list-item-id="eb0acda67602064cf3393dd478527d708"> <li>
<p><strong>Enable Sharing</strong>: To share a note, toggle the <code>Shared</code> switch <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, within the note's interface. Once sharing is enabled, an URL will appear,
which you can click to access the shared note.</p> 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"> <img src="Sharing_share-single-note.png" alt="Share Note">
</p> </p>
</li> </li>
<li data-list-item-id="e295548918d29695504a2356e807593e5"><strong>Access the Shared Note</strong>: The link provided will open the <li>
note in your browser. If your server is not configured with a public IP, <p><strong>Access the Shared Note</strong>: The link provided will open the
the URL will refer to <code>localhost (127.0.0.1)</code>.</li> 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> </ol>
<h2>Sharing a note subtree</h2> <h2>Sharing a note subtree</h2>
<p>When you share a note, you actually share the entire subtree of notes <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 <p>The default design should be a good starting point, but you can customize
it using your own CSS:</p> it using your own CSS:</p>
<ul> <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 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 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 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> the CSS code note from the tree navigation by adding the <code>#shareHiddenFromTree</code> label.</li>
<li <li><strong>Omitting Default CSS</strong>: For extensive styling changes,
data-list-item-id="ec911775f2f39d62f7a6a2ab762e3f773"><strong>Omitting Default CSS</strong>: For extensive styling changes,
use the <code>#shareOmitDefaultCss</code> label to avoid conflicts with Trilium's use the <code>#shareOmitDefaultCss</code> label to avoid conflicts with Trilium's
<a <a
href="#root/_help_Wy267RK4M69c">default stylesheet</a>.</li> 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> This will change the URL to <code>http://domain.tld/share/highlighting</code>.</p>
<p><strong>Important</strong>:</p> <p><strong>Important</strong>:</p>
<ol> <ol>
<li data-list-item-id="e15a33a78ef6f36ad0aa99341387051b0">Ensure that aliases are unique.</li> <li>Ensure that aliases are unique.</li>
<li data-list-item-id="ed1ec56ed4f152f9adceacf6053ecaac2">Using slashes (<code>/</code>) within aliases to create subpaths is not <li>Using slashes (<code>/</code>) within aliases to create subpaths is not
supported.</li> supported.</li>
</ol> </ol>
<h3>Setting a custom favicon</h3> <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 When viewed, the list of shared roots will be displayed at the bottom of
the note.</p> the note.</p>
<h2>Attribute reference</h2> <h2>Attribute reference</h2>
<figure class="table"> <table>
<table> <thead>
<thead> <tr>
<tr> <th>Attribute</th>
<th>Attribute</th> <th>Description</th>
<th>Description</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> <tr>
<tr> <td><code>shareHiddenFromTree</code>
<td><code>shareHiddenFromTree</code> </td>
</td> <td>this note is hidden from left navigation tree, but still accessible with
<td>this note is hidden from left navigation tree, but still accessible with its URL</td>
its URL</td> </tr>
</tr> <tr>
<tr> <td><code>shareExternalLink</code>
<td><code>shareExternalLink</code> </td>
</td> <td>note will act as a link to an external website in the share tree</td>
<td>note will act as a link to an external website in the share tree</td> </tr>
</tr> <tr>
<tr> <td><code>shareAlias</code>
<td><code>shareAlias</code> </td>
</td> <td>define an alias using which the note will be available under <code>https://your_trilium_host/share/[your_alias]</code>
<td>define an alias using which the note will be available under <code>https://your_trilium_host/share/[your_alias]</code> </td>
</td> </tr>
</tr> <tr>
<tr> <td><code>shareOmitDefaultCss</code>
<td><code>shareOmitDefaultCss</code> </td>
</td> <td>default share page CSS will be omitted. Use when you make extensive styling
<td>default share page CSS will be omitted. Use when you make extensive styling changes.</td>
changes.</td> </tr>
</tr> <tr>
<tr> <td><code>shareRoot</code>
<td><code>shareRoot</code> </td>
</td> <td>marks note which is served on /share root.</td>
<td>marks note which is served on /share root.</td> </tr>
</tr> <tr>
<tr> <td><code>shareDescription</code>
<td><code>shareDescription</code> </td>
</td> <td>define text to be added to the HTML meta tag for description</td>
<td>define text to be added to the HTML meta tag for description</td> </tr>
</tr> <tr>
<tr> <td><code>shareRaw</code>
<td><code>shareRaw</code> </td>
</td> <td>Note will be served in its raw format, without HTML wrapper. See also&nbsp;
<td>Note will be served in its raw format, without HTML wrapper. See also&nbsp; <a
<a class="reference-link" href="#root/_help_Qjt68inQ2bRj">Serving directly the content of a note</a>&nbsp;for an alternative method
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>
without setting an attribute.</td> </tr>
</tr> <tr>
<tr> <td><code>shareDisallowRobotIndexing</code>
<td><code>shareDisallowRobotIndexing</code> </td>
</td> <td>
<td> <p>Indicates to web crawlers that the page should not be indexed of this
<p>Indicates to web crawlers that the page should not be indexed of this note by:</p>
note by:</p> <ul>
<ul> <li data-list-item-id="e6baa9f60bf59d085fd31aa2cce07a0e7">Setting the <code>X-Robots-Tag: noindex</code> HTTP header.</li>
<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>
<li data-list-item-id="ec0d067db136ef9794e4f1033405880b7">Setting the <code>noindex, follow</code> meta tag.</li> </ul>
</ul> </td>
</td> </tr>
</tr> <tr>
<tr> <td><code>shareCredentials</code>
<td><code>shareCredentials</code> </td>
</td> <td>require credentials to access this shared note. Value is expected to be
<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
in format <code>username:password</code>. Don't forget to make this inheritable to apply to child-notes/images.</td>
to apply to child-notes/images.</td> </tr>
</tr> <tr>
<tr> <td><code>shareIndex</code>
<td><code>shareIndex</code> </td>
</td> <td>Note with this label will list all roots of shared notes.</td>
<td>Note with this label will list all roots of shared notes.</td> </tr>
</tr> </tbody>
</tbody> </table>
</table>
</figure> <h2>Credits</h2>
<h2>Credits</h2>
<p>Since v0.95.0, a new theme was introduced (and enabled by default) which <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 greatly improves the visual aspect of the Share feature, as well as its
functionality (such as mobile support, dark/light mode, collapsible tree, 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 <img src="Include Note_image.png">button. There is also a keyboard shortcut defined for it but it is not
allocated by default.</p> allocated by default.</p>
<h2>Included notes in the share functionality</h2> <h2>Included notes in the share functionality</h2>
<p>If a <a href="#root/pOsGYCXsbNQG/tC7s2alapj8V/_help_R9pX4DGra2Vt">shared note</a> contains <p>If a <a href="#root/_help_R9pX4DGra2Vt">shared note</a> contains one or
one or more included notes, they will be displayed in the content of the more included notes, they will be displayed in the content of the note
note as if they were part of the note itself.</p> as if they were part of the note itself.</p>
<p>For this to work, the included notes must also be shared, otherwise they <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 will not be shown. However, the included notes can still be hidden from
the note tree via <code>#shareHiddenFromTree</code>.</p> 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", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "6f9hih2hXXZk", "value": "nBAXQFj20hS1",
"isInheritable": false, "isInheritable": false,
"position": 20 "position": 20
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "m523cpzocqaD", "value": "6f9hih2hXXZk",
"isInheritable": false, "isInheritable": false,
"position": 30 "position": 30
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "iRwzGnHPzonm", "value": "m523cpzocqaD",
"isInheritable": false, "isInheritable": false,
"position": 40 "position": 40
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "bdUJEHsAPYQR", "value": "iRwzGnHPzonm",
"isInheritable": false, "isInheritable": false,
"position": 50 "position": 50
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "HcABDtFCkbFN", "value": "bdUJEHsAPYQR",
"isInheritable": false, "isInheritable": false,
"position": 60 "position": 60
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "GTwFsgaA0lCt", "value": "HcABDtFCkbFN",
"isInheritable": false, "isInheritable": false,
"position": 70 "position": 70
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "s1aBHPd79XYj", "value": "GTwFsgaA0lCt",
"isInheritable": false, "isInheritable": false,
"position": 80 "position": 80
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "grjYqerjn243", "value": "s1aBHPd79XYj",
"isInheritable": false, "isInheritable": false,
"position": 90 "position": 90
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "1vHRoWCEjj0L", "value": "grjYqerjn243",
"isInheritable": false, "isInheritable": false,
"position": 100 "position": 100
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "gBbsAeiuUxI5", "value": "1vHRoWCEjj0L",
"isInheritable": false, "isInheritable": false,
"position": 110 "position": 110
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "81SGnPGMk7Xc", "value": "gBbsAeiuUxI5",
"isInheritable": false, "isInheritable": false,
"position": 120 "position": 120
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "W8vYD3Q1zjCR", "value": "81SGnPGMk7Xc",
"isInheritable": false, "isInheritable": false,
"position": 130 "position": 130
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "WOcw2SLH6tbX", "value": "W8vYD3Q1zjCR",
"isInheritable": false, "isInheritable": false,
"position": 140 "position": 140
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "x3i7MxGccDuM", "value": "WOcw2SLH6tbX",
"isInheritable": false, "isInheritable": false,
"position": 150 "position": 150
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "bwZpz2ajCEwO", "value": "x3i7MxGccDuM",
"isInheritable": false, "isInheritable": false,
"position": 160 "position": 160
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "Wy267RK4M69c", "value": "bwZpz2ajCEwO",
"isInheritable": false, "isInheritable": false,
"position": 170 "position": 170
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "Qjt68inQ2bRj", "value": "Wy267RK4M69c",
"isInheritable": false, "isInheritable": false,
"position": 180 "position": 180
}, },
{
"type": "relation",
"name": "internalLink",
"value": "Qjt68inQ2bRj",
"isInheritable": false,
"position": 190
},
{ {
"type": "label", "type": "label",
"name": "shareAlias", "name": "shareAlias",
@ -10496,13 +10503,6 @@
"value": "bx bx-share-alt", "value": "bx bx-share-alt",
"isInheritable": false, "isInheritable": false,
"position": 30 "position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "nBAXQFj20hS1",
"isInheritable": false,
"position": 190
} }
], ],
"format": "markdown", "format": "markdown",
@ -13209,6 +13209,49 @@
"attachments": [] "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