File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " express-notify-telegram" ,
3- "version" : " 1.3 .0" ,
3+ "version" : " 1.4 .0" ,
44 "description" : " A simple Express middleware to notify errors into Telegram" ,
55 "main" : " index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -2,23 +2,23 @@ const escape = require('../utils/escaper');
22const statusCodeMapper = require ( '../utils/statusCodeMap' ) ;
33
44module . exports = ( req , res , options ) => {
5- const notificationTitle = res . statusCode < 500 ? '⚠️⚠️⚠️ SERVER WARNING ⚠️⚠️⚠️ ' : '⛔️⛔️⛔️ SERVER ERROR ⛔️⛔️⛔️ ' ;
5+ const notificationTitle = res . statusCode < 500 ? '⚠️ SERVER WARNING 📡 ' : '⛔️ SERVER ERROR 📡 ' ;
66 const endpoint = `\`${ req . method } \` ${ `${ req . protocol } ://${ req . get ( 'host' ) } ${ req . originalUrl } ` } ` ;
77 const appName = options . appName || process . env . APP_NAME || 'Unknown application' ;
88
99 const message = `
1010 *${ notificationTitle } *
1111
12- *🔺 APPLICATION:* ${ escape ( appName ) }
12+ *🔧 APPLICATION:* ${ escape ( appName ) }
1313
14- *🔺 ENDPOINT:* ${ endpoint }
15- *🔺 STATUS_CODE:* ${ statusCodeMapper ( res . statusCode ) }
14+ *🔧 ENDPOINT:* ${ endpoint }
15+ *🔧 STATUS_CODE:* ${ statusCodeMapper ( res . statusCode ) }
1616
17- *🔺 ERROR_MESSAGE:* ${ escape ( req . errorMessage || 'Unknown' ) }
17+ *🔧 ERROR_MESSAGE:* ${ escape ( req . errorMessage || 'Unknown' ) }
1818
19- *🔺 IP_ADDRESS:* ${ escape ( req . ip ) }
19+ *🔧 IP_ADDRESS:* ${ escape ( req . ip ) }
2020
21- *🔺 REQUEST_BODY:* \`\`\`${ JSON . stringify ( req . body || { } , null , 2 ) } \`\`\`
21+ *🔧 REQUEST_BODY:* \`\`\`${ JSON . stringify ( req . body || { } , null , 2 ) } \`\`\`
2222 ` ;
2323 return message ;
2424} ;
You can’t perform that action at this time.
0 commit comments