syntex-logger
Advanced tools
Comparing version 1.0.6 to 1.0.7-b1
51
main.js
let LanguageSwitcher = require('./language_manager'); | ||
const fs = require('fs'); | ||
const fs = require('fs'), path = require('path'); | ||
var logger, prefix, logDirectory, debugLevel = 'success'; | ||
const originalStderrWrite = process.stderr.write.bind(process.stderr); | ||
process.stderr.write = (chunk, encoding, callback) => { | ||
var reference, scriptPath, message = chunk; | ||
if(chunk.includes('[') && chunk.includes('] ')) | ||
{ | ||
message = chunk.substring(chunk.split('] ')[0].length + 2); | ||
} | ||
if(message.includes('at ')) | ||
{ | ||
var p = message.split('at ')[1]; | ||
if(p.includes('\n')) | ||
{ | ||
p = p.split('\n')[0]; | ||
} | ||
if(p.includes('(') && p.includes(':')) | ||
{ | ||
scriptPath = p.split('(')[1].split(':')[0]; | ||
} | ||
var s = (p.match(/\//g) || []).length; | ||
if(s > 0 && p.includes(':')) | ||
{ | ||
p = p.split('/')[s]; | ||
reference = { script : p.split(':')[0], row : p.split(':')[1] }; | ||
} | ||
} | ||
if(logger != null && scriptPath != null && reference != null && scriptPath.includes(path.resolve(__dirname, '../..') + '/')) | ||
{ | ||
logger.log('error', 'bridge', 'Bridge', message + ' ( [' + reference.script + '] %error[1]% [' + reference.row + '] )'); | ||
chuck = ''; | ||
} | ||
return originalStderrWrite(chunk, encoding, callback); | ||
}; | ||
module.exports = class Logger | ||
@@ -100,7 +145,7 @@ { | ||
if(error.stack != null && error.stack.split('at ')[1] != null) | ||
if(error.stack != null && error.stack.includes('at ')) | ||
{ | ||
var p = error.stack.split('at ')[1]; | ||
if(p.split('\n')[0] != null) | ||
if(p.includes('\n')) | ||
{ | ||
@@ -107,0 +152,0 @@ p = p.split('\n')[0]; |
{ | ||
"name": "syntex-logger", | ||
"version": "1.0.6", | ||
"version": "1.0.7-b1", | ||
"description": "A Basic Logging System", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
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
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
21554
461
3