bragma / winston-azure-application-insights

Azure Application Insights transport for Winston
MIT License
16 stars 25 forks source link

formatter #6

Closed fdescamps closed 6 years ago

fdescamps commented 7 years ago

Hi,

Thanks for you work. I use your module to log in appinsight from my nodejs app. But I have a question, is it possible to use a log formatter ?

function **logFormatter**(options) {
  const timestamp = moment().unix();
  const hostname = os.hostname();
  return `${timestamp}-${hostname}-${winston.config.colorize(options.level)}-${options.message}`;
}

[...]

 winston.add(require('winston-azure-application-insights').AzureApplicationInsightsLogger, {
    key: process.env[config.logger.appinsight_key],
    treatErrorsAsExceptions: true,
    handleExceptions: true,
    humanReadableUnhandledException: true,
    **formatter: **logFormatter**,**
  });

I tried to use classically (see above) but it does not work.

Thanks by advance,

F.

fdescamps commented 7 years ago

https://github.com/bragma/winston-azure-application-insights/pull/7

willmorgan commented 6 years ago

Resolved by #12 but you'll need to upgrade to 1.3 when it ships.