Notion API for application logging
You need a Notion bot and a Notion database with following properties :
- "Type": select (Log | Info | Success | Warning | Error)
- "Tags": multi-select (as you want)
- "Title": title / text
This API allows you to add lines to this database.
npm i notion-logs
// Init notion-logs
const notionLogs = require('notion-logs')({
secret: process.env.NOTION_SECRET, // Notion bot secret
database: process.env.NOTION_DATABASE, // Notion database ID
});
// Example of log
notionLogs('LOG', [], 'Test', {
Key1: {
key1: {
subKey1: 'Sub value 1',
subKey2: 'Sub value 2',
},
key2: 'Value 1',
},
Key2: 'Root value 1',
});
If you have errors in console or unwanted behavior, please create an issue here.