Giter VIP home page Giter VIP logo

pino-sendmail's Introduction

pino-sendmail

pino sendmail transport

dev deps

  1. npm install --save-dev eslint@latest jest@latest prettier@latest eslint-config-prettier@latest eslint-plugin-jest@latest eslint-plugin-prettier@latest

pino-sendmail's People

Contributors

barakok avatar slavb18 avatar

Watchers

 avatar  avatar A-Div avatar  avatar

pino-sendmail's Issues

Реализовать отправку ошибок через nodemailer

Реализовать отправку ошибок уровня error и выше через nodemailer

for await (let obj of source) {

Материалы:

https://github.com/pinojs/pino/blob/master/docs/transports.md
https://github.com/pinojs/pino-abstract-transport
https://github.com/pinojs/pino/blob/master/docs/api.md

Настройка nodemailer

  const  params = {
    smtp: {
      host: process.env.MAIL_HOST,
      port: process.env.MAIL_PORT,
      auth: {
        user: process.env.MAIL_USER,
        pass: process.env.MAIL_PASS,
      },
    },
    sendmail: {
      sendmail: true,
      newline: 'unix',
      path: process.env.MAIL_COMMAND
    }
  }
  const transporter = nodemailer.createTransport(this.params[process.env.MAIL_TRANSPORT || 'sendmail'])

Получатель: process.env.SERVER_ADMIN | 'root'
Тема сообщения: [NODEJS FATAL ERROR] ИД ОШИБКИ
ИД ОШИБКИ - какой то уникальный ИД по которому в логе потом можно найти ошибку
Тело сообщения
err.message
err.stack

см.

{
  level: 50,
  time: 1634635399343,
  pid: 1623,
  hostname: 'lenovo.lan',
  err: {
    type: 'Error',
    message: 'test',
    stack: 'Error: test\n' +
      '    at file:///home/slavb/work/pino-sendmail/test/test.js:14:14\n' +
      '    at ModuleJob.run (internal/modules/esm/module_job.js:170:25)\n' +
      '    at async Loader.import (internal/modules/esm/loader.js:178:24)\n' +
      '    at async Object.loadESM (internal/process/esm_loader.js:68:5)'
  },
  msg: 'test'
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.