1 Unstar Star 0 Fork 0

g8up / logservNodeJS

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
日志实时反馈工具 spread retract

Clone or download
g8up authored doc
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

Realtime-log

实时日志反馈工具

Usage

  • run server

PORT=8964 node index.js

or

PORT=8964 pm2 start index.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))}`;
  };
})();
  • 上报
// 属性名随意定制
log({
  title: '埋点',
  desc: '描述',
});
  • Router
Router Desc
/ 查看实时反馈
/list 展示存储的数据
/report 接收上报

Scripts

git update-index --skip-worktree db/log.sqlite

Comments ( 0 )

Sign in for post a comment

NodeJS
1
https://git.oschina.net/g8up/logserv.git
git@git.oschina.net:g8up/logserv.git
g8up
logserv
logserv
master

Search