notesy::log
Lines about the plugin for notesy's log, where the user and the plugin's author can see what it's doing: the last few under it on the Plugins page, all of them in Settings > Logs, and in notesy's log file (../../logging.md). Needs no permission.
rustuse notesy::log;
pub fn ready() {
log::debug("asked for page 2 of 5");
log::info("synced 12 notes");
log::warn("the server is slow today");
log::error("couldn't reach the server");
}
| Function | What it does |
|---|---|
log::debug(text) |
Detail for chasing a problem. Kept only while Settings > Logs keeps Debug; never shown on the Plugins page. |
log::info(text) |
A line, in the log's quiet color. |
log::warn(text) |
A line in the warning color. |
log::error(text) |
A line in the danger color, with the same mark as a failed call. |
text is a string; use a template string for values:
log::info(`${n} notes`). Don't log what's private to the user (what's
in their notes, tokens): the log is a file anyone with the computer can read.
#What notesy records about a plugin
Beside what its script says, notesy writes down what the plugin did through notesy, under the plugin's name:
- Each request: its method, site and path (never the query or the body), the status and how long it took; and ones that were refused or failed.
- Signing in to one of its accounts, and a token being refreshed (never the token).
- Notes it created, changed, renamed or deleted: which note, never what's in it. Typing into the note in front, at Debug.
- Reading the clipboard and copying to it, never what was on it.
- Pages it opened: the site.
- Anything it asked for that its permissions don't cover.
- Calls that failed, its script being reloaded, and it being stopped.
A plugin's lines are forgotten from Settings > Logs when it's removed; the log files keep them until they're a week old.
Every page
- Overview
- plugin.toml: Every field of plugin.toml
- Permissions: What a plugin can ask for, when notesy asks, and what changes it
- Scripts: How a script runs: its lifecycle, events, limits and errors
- Packing and installing: Making, checking, signing, packing and installing
- notesy::log: Lines for its log on the Plugins page
- notesy::events: Hearing what happens, and every event
- notesy::commands: Adding commands, and running notesy's
- notesy::store: Keeping its own data
- notesy::settings: Reading its settings
- notesy::secrets: Keys and tokens, in the system keychain
- notesy::notes: Reading and changing the vault's notes
- notesy::editor: The note in front
- notesy::files: A folder of its own
- notesy::links: Opening pages in the browser
- notesy::clipboard: Copying and pasting
- notesy::view: What panels, tabs and sections show
- notesy::panels and notesy::views: Adding side panels and tabs
- notesy::sections: Sidebar sections
- notesy::menus: Items in notesy's right-click menus
- notesy::status: Status bar items
- notesy::notices: Notices
- notesy::dialogs: Asking in a dialog, notesy's kinds or its own
- notesy::cards: Its part of the tree's hover cards
- notesy::boards: Boards' cards and arrows, and kinds of card of its own
- notesy::blocks: Drawing its fenced blocks
- notesy::icons: Drawing its own icons
- notesy::net: Requests to the sites it names
- notesy::accounts: Signing in to a service
- notesy::json: Reading and writing JSON
- notesy::toml: Reading and writing TOML
- notesy::yaml: Reading and writing YAML, and a note's front matter
- notesy::time: Now, written in the user's time zone, dates read, how long ago
- notesy::math: Trigonometry and the like, for drawing
- Names: Icon, Color, Tone, Side, Method, Command, Menu, Sidebar, Event: Notesy's names as enums
- notesy::preview: Its own screens for notesy preview
- notesy::perf: Timing its own work
- notesy::tex: Math macros for every note's formulas