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