Write the Code. Change the World.

7月 01

webrtc

https://meet.livekit.io/

https://juejin.cn/post/7266417942182608955

https://github.com/wang1xiang/webrtc-tutorial/tree/master/04-one-to-one

log4js

https://blog.csdn.net/weixin_57208584/article/details/134188447

https://juejin.cn/post/7221445996135022653

日志使用:

先安装

pnpm add log4js

再创建和配置

import log4js from "log4js";

const config = {
  appenders: {
    console: { 
        type: "console",
        layout: {
            type: "pattern",
            pattern: "%d{yyyy-MM-dd hh:mm:ss} - %m", // 这里定义了时间格式
        },
    },
    file: {
      type: "dateFile",
      filename: "logs/log",
      encoding: 'utf-8',
      compress: true,
      numBackups: 7,
      keepFileExt: true,
      alwaysIncludePattern: true,
      pattern: "yyyy-MM-dd.log",
      fileNameSep: '-',
      layout: {
        type: "pattern",
        pattern: "%d{yyyy-MM-dd hh:mm:ss} - [%p] - %m", // 这里定义了时间格式
      },
    },
  },
  categories: {
    default: { appenders: ["console", "file"], level: "info" },
  },
};

let logger;
if (!logger) {
  log4js.configure(config);
  logger = log4js.getLogger();
}

export default logger;