NotePlan / plugins

The main NotePlan repository, which contains the source code for all NotePlan plugins. If a release entry has been created, it will be available for installation from within NotePlan application.
MIT License
168 stars 58 forks source link

Improve logging for plugin errors #247

Closed jgclark closed 2 years ago

jgclark commented 2 years ago

In Discord conversation 15/3/2022 we settled on the following improvements:

@mikeerickson and @dwertheimer may elaborate further on this.

EduardMe commented 2 years ago

All except the first should be done by now. Added the first point just now, so will be available in the next update.

On Wed, Mar 16, 2022 at 4:32 AM Jonathan Clark @.***> wrote:

Assigned #247 https://github.com/NotePlan/plugins/issues/247 to @EduardMe https://github.com/EduardMe.

— Reply to this email directly, view it on GitHub https://github.com/NotePlan/plugins/issues/247#event-6249325881, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZCAYTIWQJJR2OAFIYA2DDVAGTA7ANCNFSM5Q3IR3WQ . You are receiving this because you were assigned.Message ID: @.***>

jgclark commented 2 years ago

Not sure whether the line number is given on an error, but the rest seems done, so closing. Thanks, @EduardMe.

dwertheimer commented 2 years ago

Not sure that I agree that the JSLog should be removed. Because you do need a way to filter/differentiate plugin logging from the lots-of-other-noise, e.g.


onCloudUpdate - 1
(sidebar) updating 1 notes
(CloudSync) onUpdate files = 1
Check for folder changes now
CloudSync: Saving 5949 items.
DataStore (CloudSync): saveJSON - Saved data to cache
'currentNotesAppCache'.
NoteCache: Saving 5730 general notes and 323 calendar notes.
DataStore (NoteCache): saveJSON - Saved data to cache 'notesAppCache'.
DataStore (NoteCache): archiveData - Saved data to cache 'calendarAppCache'
of base 'caches'.
EventStore changed
Show restored window
Access to events granted, error: nil
EventStore changed
EventStore changed
UI+URLScheme: parse incoming x-callback-url
UI+URLScheme: do something with openNote
UI+URLScheme: open note as x-callback
UI+URLScheme: note found (20220307.md), ready to open it
open date 2022-03-07 08:00:00 +0000
open calendar note: 20220307.md
saving scroll position 404.0 for 20220316.md
async open started

save note
note not updated
saveNoteIfNeeded - finished
loadExistingNote 20220307.md - finished
Set content now for 20220307.md
update version selection isconflict: false
loading scroll position 0.0) for 20220307.md

save note
begin saving - 20220307.md
note actually saved - 20220307.md
Register: 20220307.md, update: changed
(CloudSync) onUpdate files = 1
Check for folder changes now
(BackupManager) Version saved of file: 20220307.md

CloudSync (notifyUpdate):
/Users/dwertheimer/Library/Containers/co.noteplan.NotePlan3/Data/Library/Application
Support/co.noteplan.NotePlan3/Calendar/20220307.md
<http://support/co.noteplan.NotePlan3/Calendar/20220307.md>, update: changed

There are hundreds or thousands of log entries like that. Wondering aloud here…would it make sense to have a separate log for plugins? Right now, you have np-out.log, np-error.log, should there be a np-plugins.log? @eduardme thoughts?

On Wed, Mar 16, 2022 at 2:32 AM, Jonathan Clark @.***> wrote:

In Discord conversation 15/3/2022 we settled on the following improvements:

  • remove 'JSLog:' appearing in the NP log window
  • significantly reduce the logging whenever opening the Plugin Preferences window
  • emit at least line number when a plugin crashes, rather than nothing as at the moment
  • flush to main log after every write from a plugin

@mikeerickson https://github.com/mikeerickson and @dwertheimer https://github.com/dwertheimer may elaborate further on this.

— Reply to this email directly, view it on GitHub https://github.com/NotePlan/plugins/issues/247, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEI6VG7P2XF7AIMHEKMZ43VAGTBBANCNFSM5Q3IR3WQ . You are receiving this because you were mentioned.Message ID: @.***>