Skip to content

dougalg/logger-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#Readme

A simple loader that wraps modules in try/catch blocks, and allows you to specify a function to call with the error as an argument.

##Installation

npm install --save-dev logger-loader

##Usage

###webpack.config

module: {
    loaders: [
        {
            test: /.*\.js/,
            loader: 'logger-loader?module=error_logger'
        }
}

###Logging module

The above will only wrap your modules in try/catch blocks. You still need to ensure that the error_logger module returns a function that will accept the error to be logged. Essentially your code will now look like this:

try {
    ...
    Your loaded module...
    ...
}
catch (e) {
    error_logger(e);
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published