Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Small module for better crash logs and crash log saves

Notifications You must be signed in to change notification settings

zekro-archive/crashcollector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

~ crashCollector ~

Small module for better crash logs and crash log saves

 

npm install crashcollector --save

Usage

Just pull out the CrashCollector class out of the requirement and create a new instance of it in one of your files like following:

// Inclunding class CrashCollector from module
const { CrashCollector } = require('../src/index')

// Creating CrashCollector instance
// Set save path to 'crash_logs' and pass function for stuff
// to do between exception occured and program will exit
new CrashCollector('crash_logs', (err, exit) => {
    console.log('Cleaning up...')
    console.log('Saving some stuff...')
    // Calls callback funtion executing process.exit()
    // You can also just write process.exit() here
    exit()
})

Docs

CrashCollector

Crash collector class constructor

Parameter Type Optional (Default) Description
location string yes (default 'null') Path where crash logs will be saved. 'null' to disable saving log files.
functionAfterCrash function yes (default 'null') Function with expressions which will be executed between exception was catched and program will exit. This function passes as first argument the error and as second argument the exit callback function, which should be executed after all tasks are finished to close the program. Alternatively, you can also use process.exit() at this point instead of executing the callback.
options.disableWarning boolean yes (default 'false') Disable warn message when using 'functionAfterCrash'

© 2018 - present Ringo Hoffmann (zekro Development)

About

Small module for better crash logs and crash log saves

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published