docs(guide): document script logging

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

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