Socket
Socket
Sign inDemoInstall

node-opcua-debug

Package Overview
Dependencies
5
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.0 to 2.0.0-alpha.2

4

dist/display_trace.d.ts

@@ -1,2 +0,2 @@

export declare function trace_from_this_projet_only(err: Error): string;
export declare function display_trace_from_this_projet_only(err: Error): void;
export declare function trace_from_this_projet_only(err?: Error): string;
export declare function display_trace_from_this_projet_only(err?: Error): void;

@@ -10,3 +10,3 @@ "use strict";

}
err = err || new Error();
err = err || new Error("Error used to extract stack trace");
let stack = err.stack;

@@ -13,0 +13,0 @@ if (stack) {

export declare function setDebugFlag(scriptFullpath: string, flag: boolean): void;
export declare function checkDebugFlag(script_fullpath: string): boolean;
export declare function checkDebugFlag(scriptFullpath: string): boolean;
/**

@@ -10,2 +10,2 @@ * @method make_debugLog

*/
export declare function make_debugLog(scripFullpath: string): Function;
export declare function make_debugLog(scripFullpath: string): (...arg: any[]) => void;

@@ -6,3 +6,4 @@ "use strict";

const _ = require("underscore");
let debugFlags = {};
const util_1 = require("util");
const debugFlags = {};
function w(str, l) {

@@ -14,4 +15,4 @@ return (str + " ").substr(0, l);

if (process.env.DEBUG) {
const decorated_filename = chalk_1.default.yellow(w(filename, 30));
console.log(" Setting debug for ", decorated_filename, " to ", (flag ? chalk_1.default.cyan : chalk_1.default.red)(flag.toString()));
const decoratedFilename = chalk_1.default.yellow(w(filename, 30));
console.log(" Setting debug for ", decoratedFilename, " to ", (flag ? chalk_1.default.cyan : chalk_1.default.red)(flag.toString()));
}

@@ -21,4 +22,4 @@ debugFlags[filename] = flag;

exports.setDebugFlag = setDebugFlag;
function checkDebugFlag(script_fullpath) {
const filename = path.basename(script_fullpath, ".js");
function checkDebugFlag(scriptFullpath) {
const filename = path.basename(scriptFullpath, ".js");
let doDebug = debugFlags[filename];

@@ -32,4 +33,5 @@ if (process && process.env && process.env.DEBUG && !debugFlags.hasOwnProperty(filename)) {

exports.checkDebugFlag = checkDebugFlag;
function file_line(filename, caller_line) {
return chalk_1.default.bgWhite.cyan(w(filename, 30) + ":" + w(caller_line.toString(), 5));
function file_line(filename, callerLine) {
const d = (new Date()).toISOString().substr(11);
return chalk_1.default.bgWhite.cyan(w(d, 14) + ":" + w(filename, 30) + ":" + w(callerLine.toString(), 5));
}

@@ -48,10 +50,20 @@ /**

if (debugFlags[filename]) {
const stack = new Error().stack || "";
const stack = new Error("").stack || "";
// caller line number
const l = stack.split("\n")[2].split(":");
const caller_line = parseInt(l[l.length - 2]);
const a1 = [file_line(filename, caller_line)];
const callerLine = parseInt(l[l.length - 2]);
let a1 = [file_line(filename, callerLine)];
const a2 = _.values(arguments);
const args = [].concat(a1, a2);
console.log.apply(console, args);
const output = util_1.format.apply(null, a2);
let i = 0;
for (const line of output.split("\n")) {
const args = [].concat(a1, [line]);
console.log.apply(console, args);
a1 = [w(' ... ', 51)];
i = i + 1;
if (i > 20) {
console.log.apply(console, a1.concat([" .... TRUNCATED ....."]));
break;
}
}
}

@@ -58,0 +70,0 @@ }

{
"name": "node-opcua-debug",
"version": "0.5.0",
"version": "2.0.0-alpha.2",
"description": "pure nodejs OPCUA SDK - module -debug",

@@ -12,4 +12,4 @@ "scripts": {

"hexy": "^0.2.11",
"node-opcua-assert": "^0.5.0",
"node-opcua-buffer-utils": "^0.5.0",
"node-opcua-assert": "^2.0.0-alpha.2",
"node-opcua-buffer-utils": "^2.0.0-alpha.2",
"underscore": "^1.9.1"

@@ -21,4 +21,4 @@ },

},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"author": "Etienne Rossignon",

@@ -39,3 +39,3 @@ "license": "MIT",

"homepage": "http://node-opcua.github.io/",
"gitHead": "7c2f2dcb6ebdc49e57da1a028406a307df502d4e"
"gitHead": "7f57dd90e9d8bd1abcb8d330b3470999ac51e33f"
}
import chalk from "chalk";
export function trace_from_this_projet_only(err: Error): string {
export function trace_from_this_projet_only(err?: Error): string {

@@ -10,3 +10,3 @@ const str = [];

}
err = err || new Error();
err = err || new Error("Error used to extract stack trace");
let stack: any = err.stack;

@@ -23,4 +23,4 @@ if (stack) {

export function display_trace_from_this_projet_only(err: Error): void {
export function display_trace_from_this_projet_only(err?: Error): void {
console.log(trace_from_this_projet_only(err));
}
import chalk from "chalk";
const path = require("path");
const _ = require("underscore");
import { format } from "util";
let debugFlags: { [id: string]: boolean } = {};
const debugFlags: { [id: string]: boolean } = {};

@@ -14,6 +15,6 @@ function w(str: string, l: number): string {

if (process.env.DEBUG) {
const decorated_filename = chalk.yellow(w(filename, 30));
const decoratedFilename = chalk.yellow(w(filename, 30));
console.log(
" Setting debug for ",
decorated_filename,
decoratedFilename,
" to ",

@@ -26,7 +27,7 @@ (flag ? chalk.cyan : chalk.red)(flag.toString())

export function checkDebugFlag(script_fullpath: string): boolean {
const filename = path.basename(script_fullpath, ".js");
let doDebug:boolean = debugFlags[filename];
export function checkDebugFlag(scriptFullpath: string): boolean {
const filename = path.basename(scriptFullpath, ".js");
let doDebug: boolean = debugFlags[filename];
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);

@@ -37,5 +38,7 @@ }

function file_line(filename: string, caller_line: number):string {
return chalk.bgWhite.cyan(w(filename, 30) + ":" + w(caller_line.toString(), 5));
function file_line(filename: string, callerLine: number): string {
const d = (new Date()).toISOString().substr(11);
return chalk.bgWhite.cyan(w(d,14)+":" + w(filename, 30) + ":" + w(callerLine.toString(), 5));
}
/**

@@ -48,3 +51,3 @@ * @method make_debugLog

*/
export function make_debugLog(scripFullpath: string): Function {
export function make_debugLog(scripFullpath: string): (...arg: any[]) => void {

@@ -57,15 +60,28 @@ const doDebug: boolean = checkDebugFlag(scripFullpath);

if (debugFlags[filename]) {
const stack: string = new Error().stack || "";
const stack: string = new Error("").stack || "";
// caller line number
const l: Array<string> = stack.split("\n")[2].split(":");
const caller_line: number = parseInt(l[l.length - 2]);
const a1:string[] = [file_line(filename, caller_line)];
const a2:string[] = _.values(arguments);
const args :string[] = ([] as string[]).concat(a1, a2);
console.log.apply(console, args);
const l: string[] = stack.split("\n")[2].split(":");
const callerLine: number = parseInt(l[l.length - 2]);
let a1: string[] = [file_line(filename, callerLine)];
const a2: string[] = _.values(arguments);
const output = format.apply(null,a2);
let i =0;
for(const line of output.split("\n")) {
const args: string[] = ([] as string[]).concat(a1,[line]);
console.log.apply(console, args);
a1= [w(' ... ', 51)];
i = i+1;
if (i>20) {
console.log.apply(console, a1.concat([" .... TRUNCATED ....."]));
break;
}
}
}
}
return debugLogFunc;
}
{
"extends" : "../tsconfig.json",
"compilerOptions": {
"skipLibCheck": true,
"target": "es6",
"module": "commonjs",
"declaration": true,
"outDir": "./dist",
"sourceMap": true,
"sourceRoot": "./source",
"strict": true
"rootDir": "source",
"outDir": "dist"
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc