@juntoz/azure-function-logger-papertrail
v1.0.3
Published
Quick logger that enables the function to log to the default logger (console) and also to papertrail
Downloads
7
Readme
azure-function-logger-papertrail
Quick logger that enables the function to log to the default logger (console) and also to papertrail
how to use it?
Install it
npm install @juntoz/azure-function-logger-papertrail
Instantiate it
const Logger = require('@juntoz/azure-function-logger-papertrail');
async function main_azfunc(ctx) {
var papertrailConfig = {
host: 'PapertrailHost',
port: PapetrailPort,
app: 'PapertrailAppName'
};
// initiate the logger and send the papertrail config and the official logger
ctx.llog = new Logger(papertrailConfig, ctx.log);
// execute the function business logic
try
{
// ...
ctx.llog.debug(`debugging`);
// ...
ctx.llog.info(`informing`);
} catch (err) {
ctx.llog.error(`error found`);
throw err;
} finally {
// make sure to end the logger for each call
ctx.llog.end();
}
}
module.exports = main_azfunc;