Added log rocket + analytics to ensure functionality
This commit is contained in:
@@ -8,6 +8,7 @@ const {
|
||||
NewNotification,
|
||||
} = require("../notification-wrapper/notification-wrapper");
|
||||
const log = require("electron-log");
|
||||
const Nucleus = require("nucleus-nodejs");
|
||||
var watcher;
|
||||
|
||||
async function StartWatcher() {
|
||||
@@ -53,23 +54,24 @@ async function StartWatcher() {
|
||||
console.log("File", path, "has been added");
|
||||
HandleNewFile(path);
|
||||
})
|
||||
.on("addDir", function (path) {
|
||||
console.log("Directory", path, "has been added");
|
||||
})
|
||||
// .on("addDir", function (path) {
|
||||
// console.log("Directory", path, "has been added");
|
||||
// })
|
||||
.on("change", async function (path) {
|
||||
console.log("File", path, "has been changed");
|
||||
HandleNewFile(path);
|
||||
})
|
||||
.on("unlink", function (path) {
|
||||
console.log("File", path, "has been removed");
|
||||
})
|
||||
.on("unlinkDir", function (path) {
|
||||
console.log("Directory", path, "has been removed");
|
||||
})
|
||||
// .on("unlink", function (path) {
|
||||
// console.log("File", path, "has been removed");
|
||||
// })
|
||||
// .on("unlinkDir", function (path) {
|
||||
// console.log("Directory", path, "has been removed");
|
||||
// })
|
||||
.on("error", function (error) {
|
||||
console.log("Error happened", error);
|
||||
log.error("Error in Watcher", error);
|
||||
const b = BrowserWindow.getFocusedWindow();
|
||||
b.webContents.send(ipcTypes.fileWatcher.toRenderer.error, error);
|
||||
Nucleus.track("WATCHER_ERROR", error);
|
||||
})
|
||||
.on("ready", onWatcherReady)
|
||||
.on("raw", function (event, path, details) {
|
||||
@@ -81,14 +83,14 @@ async function StartWatcher() {
|
||||
}
|
||||
|
||||
function onWatcherReady() {
|
||||
console.log("Ready!");
|
||||
log.info("Watcher ready!");
|
||||
const b = BrowserWindow.getAllWindows()[0];
|
||||
b.webContents.send(ipcTypes.default.fileWatcher.toRenderer.startSuccess);
|
||||
NewNotification({
|
||||
title: "RPS Watcher Started",
|
||||
body: "Newly exported estimates will be automatically uploaded.",
|
||||
});
|
||||
console.log("Confirmed watched paths:", watcher.getWatched());
|
||||
log.info("Confirmed watched paths:", watcher.getWatched());
|
||||
}
|
||||
|
||||
async function StopWatcher() {
|
||||
@@ -107,5 +109,6 @@ exports.StopWatcher = StopWatcher;
|
||||
exports.watcher = watcher;
|
||||
|
||||
async function HandleNewFile(path) {
|
||||
Nucleus.track("IMPORT_JOB_FROM_WATCHER");
|
||||
await ImportJob(path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user