node-opcua-debug
Advanced tools
Comparing version 2.6.0-alpha.1 to 2.6.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.display_trace_from_this_projet_only = exports.trace_from_this_projet_only = void 0; | ||
/** | ||
* @module node-opcua-debug | ||
*/ | ||
// tslint:disable:no-console | ||
const chalk = require("chalk"); | ||
@@ -5,0 +9,0 @@ function trace_from_this_projet_only(err) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dumpIf = exports.dump = void 0; | ||
/** | ||
* @module node-opcua-debug | ||
*/ | ||
// tslint:disable:no-console | ||
const util = require("util"); | ||
@@ -5,0 +9,0 @@ function dump(obj) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getTempFilename = void 0; | ||
/** | ||
* @module node-opcua-debug | ||
*/ | ||
const fs = require("fs"); | ||
@@ -5,0 +8,0 @@ const path = require("path"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hexDump = void 0; | ||
/** | ||
* @module node-opcua-debug | ||
*/ | ||
// tslint:disable:no-var-requires | ||
const hexy = require("hexy"); | ||
@@ -5,0 +9,0 @@ function hexDump(buffer, width = 32, maxSize = 1024) { |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @module node-opcua-debug | ||
*/ | ||
export { trace_from_this_projet_only, display_trace_from_this_projet_only } from "./display_trace"; | ||
@@ -2,0 +5,0 @@ export { checkDebugFlag, setDebugFlag, make_debugLog, make_errorLog } from "./make_loggers"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* @module node-opcua-debug | ||
*/ | ||
var display_trace_1 = require("./display_trace"); | ||
@@ -4,0 +7,0 @@ Object.defineProperty(exports, "trace_from_this_projet_only", { enumerable: true, get: function () { return display_trace_1.trace_from_this_projet_only; } }); |
export declare function setDebugFlag(scriptFullPath: string, flag: boolean): void; | ||
export declare function checkDebugFlag(scriptFullPath: string): boolean; | ||
/** | ||
* @method make_debugLog | ||
* @param scriptFullPath:string | ||
* @return returns a debugLog function that will write message to the console | ||
* if the DEBUG environment variable indicates that the provided source file shall display debug trace | ||
* | ||
*/ | ||
export declare function make_debugLog(scriptFullPath: string): (...arg: any[]) => void; | ||
export declare function make_errorLog(context: string): (...arg: any[]) => void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.make_errorLog = exports.make_debugLog = exports.checkDebugFlag = exports.setDebugFlag = void 0; | ||
/** | ||
* @module node-opcua-debug | ||
*/ | ||
// tslint:disable:no-console | ||
const chalk = require("chalk"); | ||
@@ -36,2 +40,7 @@ const path = require("path"); | ||
exports.checkDebugFlag = checkDebugFlag; | ||
/** | ||
* file_line return a 51 caracter string | ||
* @param filename | ||
* @param callerLine | ||
*/ | ||
function file_line(mode, filename, callerLine) { | ||
@@ -49,2 +58,3 @@ const d = (new Date()).toISOString().substr(11); | ||
const stack = new Error("").stack || ""; | ||
// caller line number | ||
const l = stack.split("\n")[4].split(":"); | ||
@@ -72,2 +82,9 @@ const callerLine = parseInt(l[l.length - 2], 10); | ||
} | ||
/** | ||
* @method make_debugLog | ||
* @param scriptFullPath:string | ||
* @return returns a debugLog function that will write message to the console | ||
* if the DEBUG environment variable indicates that the provided source file shall display debug trace | ||
* | ||
*/ | ||
function make_debugLog(scriptFullPath) { | ||
@@ -74,0 +91,0 @@ const filename = extractBasename(scriptFullPath); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.makebuffer_from_trace = exports.inlineText = void 0; | ||
/** | ||
* @module node-opcua-debug | ||
*/ | ||
const node_opcua_buffer_utils_1 = require("node-opcua-buffer-utils"); | ||
@@ -20,2 +23,3 @@ function inlineText(f) { | ||
} | ||
// find prefix | ||
const prefixLength = lines[0].match(/[0-9a-fA-F:]*\ +/)[0].length; | ||
@@ -39,2 +43,3 @@ for (let line of lines) { | ||
} | ||
// tslint:disable:ban-types | ||
function makebuffer_from_trace(func) { | ||
@@ -41,0 +46,0 @@ if (typeof func === "string") { |
@@ -0,1 +1,7 @@ | ||
/** | ||
* @method redirectToFile | ||
* @param tmpFile {String} log file name to redirect console output. | ||
* @param actionFct the inner function to execute | ||
* @param callback | ||
*/ | ||
export declare function redirectToFile(tmpFile: string, actionFct: Function, callback: ((err?: Error) => void) | null): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.redirectToFile = void 0; | ||
/** | ||
* @module node-opcua-debug | ||
*/ | ||
// tslint:disable:no-console | ||
// tslint:disable:ban-types | ||
const fs = require("fs"); | ||
@@ -9,2 +14,8 @@ const _ = require("underscore"); | ||
const get_temp_filename_1 = require("./get_temp_filename"); | ||
/** | ||
* @method redirectToFile | ||
* @param tmpFile {String} log file name to redirect console output. | ||
* @param actionFct the inner function to execute | ||
* @param callback | ||
*/ | ||
function redirectToFile(tmpFile, actionFct, callback) { | ||
@@ -16,2 +27,3 @@ let oldConsoleLog; | ||
const logFile = get_temp_filename_1.getTempFilename(tmpFile); | ||
// xx console.log(" log_file ",log_file); | ||
const f = fs.createWriteStream(logFile, { flags: "w", encoding: "ascii" }); | ||
@@ -28,2 +40,3 @@ function _write_to_file(...args) { | ||
console.log = _write_to_file; | ||
// async version | ||
try { | ||
@@ -36,2 +49,4 @@ actionFct(); | ||
console.log("redirectToFile has intercepted an error :", err); | ||
// we don't want the callback anymore since we got an error | ||
// display file on screen for investigation | ||
console.log(fs.readFileSync(logFile).toString("ascii")); | ||
@@ -50,2 +65,3 @@ f.end(() => { | ||
console.log = _write_to_file; | ||
// async version | ||
actionFct((err) => { | ||
@@ -52,0 +68,0 @@ node_opcua_assert_1.assert(_.isFunction(callback)); |
{ | ||
"name": "node-opcua-debug", | ||
"version": "2.6.0-alpha.1", | ||
"version": "2.6.1", | ||
"description": "pure nodejs OPCUA SDK - module -debug", | ||
@@ -13,4 +13,4 @@ "scripts": { | ||
"hexy": "^0.3.0", | ||
"node-opcua-assert": "^2.6.0-alpha.1", | ||
"node-opcua-buffer-utils": "^2.6.0-alpha.1", | ||
"node-opcua-assert": "^2.6.1", | ||
"node-opcua-buffer-utils": "^2.6.1", | ||
"underscore": "^1.10.2" | ||
@@ -39,3 +39,3 @@ }, | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "becfcbe561410100413321e3f7f3913c6f75b837" | ||
"gitHead": "15f0c0f83232fc63310dc04fea187048c7a01e4b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
39391
675
0
Updatednode-opcua-assert@^2.6.1