How to use the @node-red/util.log.warn function in @node-red/util

To help you get started, we’ve selected a few @node-red/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-red / node-red / packages / node_modules / @node-red / runtime / lib / storage / localfilesystem / projects / index.js View on Github external
function getFlows() {
    if (!initialFlowLoadComplete) {
        initialFlowLoadComplete = true;
        log.info(log._("storage.localfilesystem.user-dir",{path:settings.userDir}));
        if (activeProject) {
            // At this point activeProject will be a string, so go load it and
            // swap in an instance of Project
            return loadProject(activeProject).then(function() {
                log.info(log._("storage.localfilesystem.projects.active-project",{project:activeProject.name||"none"}));
                log.info(log._("storage.localfilesystem.flows-file",{path:flowsFullPath}));
                return getFlows();
            });
        } else {
            if (projectsEnabled) {
                log.warn(log._("storage.localfilesystem.projects.no-active-project"))
            } else {
                projectLogMessages.forEach(log.warn);
            }
            log.info(log._("storage.localfilesystem.flows-file",{path:flowsFullPath}));
        }
    }
    if (activeProject) {
        var error;
        if (activeProject.isEmpty()) {
            log.warn("Project repository is empty");
            error = new Error("Project repository is empty");
            error.code = "project_empty";
            return when.reject(error);
        }
        if (activeProject.missingFiles && activeProject.missingFiles.indexOf('package.json') !== -1) {
            log.warn("Project missing package.json");
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / context / localfilesystem.js View on Github external
key = [key];
                value = [value];
            } else if (!Array.isArray(value)) {
                // key is an array, but value is not - wrap it as an array
                value = [value];
            }
            for (var i=0;i
github node-red / node-red / packages / node_modules / @node-red / editor-api / lib / editor / comms.js View on Github external
wsServer.on('error', function(err) {
                log.warn(log._("comms.error-server",{message:err.toString()}));
            });
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / context / index.js View on Github external
function logUnknownStore(name) {
    if (name) {
        var count = unknownStores[name] || 0;
        if (count == 0) {
            log.warn(log._("context.unknown-store", {name: name}));
            count++;
            unknownStores[name] = count;
        }
    }
}
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / storage / localfilesystem / projects / index.js View on Github external
return when.reject(error);
        }
        if (activeProject.missingFiles && activeProject.missingFiles.indexOf('package.json') !== -1) {
            log.warn("Project missing package.json");
            error = new Error("Project missing package.json");
            error.code = "missing_package_file";
            return when.reject(error);
        }
        if (!activeProject.getFlowFile()) {
            log.warn("Project has no flow file");
            error = new Error("Project has no flow file");
            error.code = "missing_flow_file";
            return when.reject(error);
        }
        if (activeProject.isMerging()) {
            log.warn("Project has unmerged changes");
            error = new Error("Project has unmerged changes. Cannot load flows");
            error.code = "git_merge_conflict";
            return when.reject(error);
        }

    }
    return util.readFile(flowsFullPath,flowsFileBackup,null,'flow').then(function(result) {
        if (result === null) {
            flowsFileExists = false;
            return [];
        }
        flowsFileExists = true;
        return result;
    });
}
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / storage / localfilesystem / projects / index.js View on Github external
log.info(log._("storage.localfilesystem.flows-file",{path:flowsFullPath}));
                return getFlows();
            });
        } else {
            if (projectsEnabled) {
                log.warn(log._("storage.localfilesystem.projects.no-active-project"))
            } else {
                projectLogMessages.forEach(log.warn);
            }
            log.info(log._("storage.localfilesystem.flows-file",{path:flowsFullPath}));
        }
    }
    if (activeProject) {
        var error;
        if (activeProject.isEmpty()) {
            log.warn("Project repository is empty");
            error = new Error("Project repository is empty");
            error.code = "project_empty";
            return when.reject(error);
        }
        if (activeProject.missingFiles && activeProject.missingFiles.indexOf('package.json') !== -1) {
            log.warn("Project missing package.json");
            error = new Error("Project missing package.json");
            error.code = "missing_package_file";
            return when.reject(error);
        }
        if (!activeProject.getFlowFile()) {
            log.warn("Project has no flow file");
            error = new Error("Project has no flow file");
            error.code = "missing_flow_file";
            return when.reject(error);
        }
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / storage / localfilesystem / projects / index.js View on Github external
} else {
                projectLogMessages.forEach(log.warn);
            }
            log.info(log._("storage.localfilesystem.flows-file",{path:flowsFullPath}));
        }
    }
    if (activeProject) {
        var error;
        if (activeProject.isEmpty()) {
            log.warn("Project repository is empty");
            error = new Error("Project repository is empty");
            error.code = "project_empty";
            return when.reject(error);
        }
        if (activeProject.missingFiles && activeProject.missingFiles.indexOf('package.json') !== -1) {
            log.warn("Project missing package.json");
            error = new Error("Project missing package.json");
            error.code = "missing_package_file";
            return when.reject(error);
        }
        if (!activeProject.getFlowFile()) {
            log.warn("Project has no flow file");
            error = new Error("Project has no flow file");
            error.code = "missing_flow_file";
            return when.reject(error);
        }
        if (activeProject.isMerging()) {
            log.warn("Project has unmerged changes");
            error = new Error("Project has unmerged changes. Cannot load flows");
            error.code = "git_merge_conflict";
            return when.reject(error);
        }