Whats the best way to create a persistent crash log?

I’m trying to write a discord bot, and am having trouble debugging a crash. Because glitch auto-restarts on crash, the in-browser log gets filled with startup stuff, erasing what was there before.

it seems like there should be a simple way to see the last error that caused glitch to restart.

I’ve looked at logging tools such as winston, but it seems too extensive for what I need.Has anyone else solved this issue, or have suggestions on how to handle crash logs specifically?

I’ve gone about this in a few different ways. For simple uses (especially if it’s OK for the logs to be public), I log to the file system. I do that, for example, here:

And then for slightly-more-serious apps, I like to publish the logs to a 3rd party provider. For simple apps, I’m happy enough with Logg.ly; they have a free teir with one-week retention.

I set up logg.ly with Winston in this app: