You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
1.1 KiB

/**
* This file is loaded via the <script> tag in the index.html file and will
* be executed in the renderer process for that window. No Node.js APIs are
* available in this process because `nodeIntegration` is turned off and
* `contextIsolation` is turned on. Use the contextBridge API in `preload.js`
* to expose Node.js functionality from the main process.
*/
let {ipcRenderer} = require("electron");
const log = require('electron-log');
log.transports.file.level = 'info'
log.transports.file.maxSize = 10024300 // 文件最大不超过 10M
log.transports.file.format = '[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}'// 输出格式
let date = new Date()
let dateStr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
log.transports.file.resolvePath = () => 'log\\' + dateStr+ '.log';
// 监听回复事件
ipcRenderer.on("lc-print-pre-message-reply",(event,arg)=>{
console.log(event);
console.log('args:'+arg);
log.info('args:'+arg)
})
let btnPre = document.querySelector("#btn");
btnPre.onclick=function(){
ipcRenderer.send("lc-print-pre-message","this is a input parameters");
}