# logserv **Repository Path**: g8up/logserv ## Basic Information - **Project Name**: logserv - **Description**: 日志实时反馈工具 - **Primary Language**: NodeJS - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2015-10-08 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Realtime-log > 实时日志反馈工具 # Usage - run server > PORT=8964 node index.js or > PORT=8964 pm2 start index.js - 引入上报脚本 ```js const debug = true; /* * 上报脚本 */ export const log = (() => { if (!debug) { return; } const LogServerHost = 'http://localhost:8964'; // 收集 log 的服务 const list = []; return (desc) => { list.push(desc); new Image().src = `${LogServerHost}/report?data=${encodeURIComponent(JSON.stringify(list))}`; }; })(); ``` - 上报 ```js // 属性名随意定制 log({ title: '埋点', desc: '描述', }); ``` - Router | Router | Desc | |-|-| | / | 查看实时反馈 | | /list | 展示存储的数据 | | /report | 接收上报 | ## Scripts > git update-index --skip-worktree db/log.sqlite