node-opcua-debug
Advanced tools
Comparing version 2.16.0 to 2.17.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dumpIf = exports.dump = exports.redirectToFile = exports.hexDump = exports.inlineText = exports.makebuffer_from_trace = exports.getTempFilename = exports.make_errorLog = exports.make_debugLog = exports.setDebugFlag = exports.checkDebugFlag = exports.display_trace_from_this_projet_only = exports.trace_from_this_projet_only = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ * @module node-opcua-debug |
@@ -10,7 +10,7 @@ "use strict"; | ||
const path = require("path"); | ||
const _ = require("underscore"); | ||
const util_1 = require("util"); | ||
const debugFlags = {}; | ||
const maxLines = (process.env && process.env.NODEOPCUA_DEBUG_MAXLINE_PER_MESSAGE) ? | ||
parseInt(process.env.NODEOPCUA_DEBUG_MAXLINE_PER_MESSAGE, 10) : 25; | ||
const maxLines = process.env && process.env.NODEOPCUA_DEBUG_MAXLINE_PER_MESSAGE | ||
? parseInt(process.env.NODEOPCUA_DEBUG_MAXLINE_PER_MESSAGE, 10) | ||
: 25; | ||
function extractBasename(name) { | ||
@@ -35,3 +35,3 @@ return path.basename(name).replace(/\.(js|ts)$/, ""); | ||
if (process && process.env && process.env.DEBUG && !debugFlags.hasOwnProperty(filename)) { | ||
doDebug = (process.env.DEBUG.indexOf(filename) >= 0 || process.env.DEBUG.indexOf("ALL") >= 0); | ||
doDebug = process.env.DEBUG.indexOf(filename) >= 0 || process.env.DEBUG.indexOf("ALL") >= 0; | ||
setDebugFlag(filename, doDebug); | ||
@@ -48,3 +48,3 @@ } | ||
function file_line(mode, filename, callerLine) { | ||
const d = (new Date()).toISOString().substr(11); | ||
const d = new Date().toISOString().substr(11); | ||
if (mode === "D") { | ||
@@ -67,3 +67,3 @@ return chalk.bgWhite.cyan(w(d, 14) + ":" + w(filename, 30) + ":" + w(callerLine.toString(), 5)); | ||
function dump(mode, args1) { | ||
const a2 = _.values(args1); | ||
const a2 = Object.values(args1); | ||
const output = util_1.format.apply(null, a2); | ||
@@ -70,0 +70,0 @@ let a1 = [buildPrefix(mode)]; |
@@ -40,2 +40,3 @@ "use strict"; | ||
actionFct(); | ||
f.end(callback); | ||
} | ||
@@ -55,4 +56,5 @@ catch (err) { | ||
} | ||
console.log = oldConsoleLog; | ||
f.end(callback); | ||
finally { | ||
console.log = oldConsoleLog; | ||
} | ||
} | ||
@@ -59,0 +61,0 @@ else { |
{ | ||
"name": "node-opcua-debug", | ||
"version": "2.16.0", | ||
"version": "2.17.0", | ||
"description": "pure nodejs OPCUA SDK - module -debug", | ||
@@ -14,4 +14,3 @@ "scripts": { | ||
"node-opcua-assert": "2.16.0", | ||
"node-opcua-buffer-utils": "2.16.0", | ||
"underscore": "^1.10.2" | ||
"node-opcua-buffer-utils": "2.17.0" | ||
}, | ||
@@ -39,3 +38,3 @@ "devDependencies": { | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "9fa7d50952a7c39ff6790888a2bd6f32fe46836d" | ||
"gitHead": "545072c8184378254468c383b78e74e7e8e31ab7" | ||
} |
@@ -7,3 +7,2 @@ /** | ||
import * as path from "path"; | ||
import * as _ from "underscore"; | ||
import { format } from "util"; | ||
@@ -13,4 +12,6 @@ | ||
const maxLines = (process.env && process.env.NODEOPCUA_DEBUG_MAXLINE_PER_MESSAGE) ? | ||
parseInt(process.env.NODEOPCUA_DEBUG_MAXLINE_PER_MESSAGE, 10) : 25; | ||
const maxLines = | ||
process.env && process.env.NODEOPCUA_DEBUG_MAXLINE_PER_MESSAGE | ||
? parseInt(process.env.NODEOPCUA_DEBUG_MAXLINE_PER_MESSAGE, 10) | ||
: 25; | ||
@@ -43,3 +44,3 @@ function extractBasename(name: string) { | ||
if (process && process.env && process.env.DEBUG && !debugFlags.hasOwnProperty(filename)) { | ||
doDebug = (process.env.DEBUG.indexOf(filename) >= 0 || process.env.DEBUG.indexOf("ALL") >= 0); | ||
doDebug = process.env.DEBUG.indexOf(filename) >= 0 || process.env.DEBUG.indexOf("ALL") >= 0; | ||
setDebugFlag(filename, doDebug); | ||
@@ -56,3 +57,3 @@ } | ||
function file_line(mode: "E" | "D", filename: string, callerLine: number): string { | ||
const d = (new Date()).toISOString().substr(11); | ||
const d = new Date().toISOString().substr(11); | ||
if (mode === "D") { | ||
@@ -77,4 +78,3 @@ return chalk.bgWhite.cyan(w(d, 14) + ":" + w(filename, 30) + ":" + w(callerLine.toString(), 5)); | ||
function dump(mode: "E" | "D", args1: [any?, ...any[]]) { | ||
const a2 = _.values(args1) as [string, ...string[]]; | ||
const a2 = Object.values(args1) as [string, ...string[]]; | ||
const output = format.apply(null, a2); | ||
@@ -95,3 +95,2 @@ let a1 = [buildPrefix(mode)]; | ||
} | ||
} | ||
@@ -107,3 +106,2 @@ | ||
export function make_debugLog(scriptFullPath: string): (...arg: any[]) => void { | ||
const filename = extractBasename(scriptFullPath); | ||
@@ -121,3 +119,2 @@ | ||
export function make_errorLog(context: string): (...arg: any[]) => void { | ||
function errorLogFunc(...args: [any?, ...any[]]) { | ||
@@ -124,0 +121,0 @@ dump("E", args); |
@@ -47,2 +47,3 @@ /** | ||
actionFct(); | ||
f.end(callback); | ||
} catch (err) { | ||
@@ -63,5 +64,5 @@ console.log = oldConsoleLog; | ||
}); | ||
} finally { | ||
console.log = oldConsoleLog; | ||
} | ||
console.log = oldConsoleLog; | ||
f.end(callback); | ||
} else { | ||
@@ -68,0 +69,0 @@ oldConsoleLog = console.log; |
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
39601
4
675
+ Addednode-opcua-buffer-utils@2.17.0(transitive)
- Removedunderscore@^1.10.2
- Removednode-opcua-buffer-utils@2.16.0(transitive)
- Removedunderscore@1.13.7(transitive)