Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7be0e70754 | |||
| 8b0ceb759d | |||
| 7b5cfb2c95 | |||
| a4a5b18849 | |||
| 47583bd955 | |||
| 018bc7054a | |||
| 5ca4cb9964 | |||
| 27bb9a789c | |||
| 5f7e68d5b7 | |||
| da0edc478c | |||
| d2be068597 | |||
| 4113a9a211 |
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartlog",
|
"name": "@pushrocks/smartlog",
|
||||||
"version": "2.0.29",
|
"version": "2.0.35",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1188,9 +1188,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartlog-interfaces": {
|
"@pushrocks/smartlog-interfaces": {
|
||||||
"version": "2.0.19",
|
"version": "2.0.20",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog-interfaces/-/smartlog-interfaces-2.0.19.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog-interfaces/-/smartlog-interfaces-2.0.20.tgz",
|
||||||
"integrity": "sha512-H4iQm1ZRSxnBTUy58WQ3VY0kFLHTm0eXrZX0+UPptgBQoZ8DZZow+bbY7yo0s4+q1EN0NqpJWVRkOQmZJ0asJg==",
|
"integrity": "sha512-PR3l5UVor+//UoeOLws7hX4AtL2eWEHUC4uvjRY9wkrZt3XxemzWzPYXXlBUrdr5DPqt1b7tKcOx8xyUoUei9g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@apiglobal/typedrequest-interfaces": "^1.0.13"
|
"@apiglobal/typedrequest-interfaces": "^1.0.13"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartlog",
|
"name": "@pushrocks/smartlog",
|
||||||
"version": "2.0.29",
|
"version": "2.0.35",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "minimalistic distributed and extensible logging tool",
|
"description": "minimalistic distributed and extensible logging tool",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gitzone/tsbundle": "^1.0.69",
|
"@gitzone/tsbundle": "^1.0.69",
|
||||||
"@pushrocks/isounique": "^1.0.4",
|
"@pushrocks/isounique": "^1.0.4",
|
||||||
"@pushrocks/smartlog-interfaces": "^2.0.19"
|
"@pushrocks/smartlog-interfaces": "^2.0.20"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
|||||||
@@ -40,4 +40,9 @@ tap.test('should create a log group', async () => {
|
|||||||
logGroup.log('info', 'this is logged from a log group');
|
logGroup.log('info', 'this is logged from a log group');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should catch error', async () => {
|
||||||
|
console.error(new Error('hey'));
|
||||||
|
// throw new Error('hey');
|
||||||
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
|||||||
@@ -4,7 +4,12 @@ import * as plugins from './smartlog.plugins';
|
|||||||
* a console log optimized for smartlog
|
* a console log optimized for smartlog
|
||||||
*/
|
*/
|
||||||
export class ConsoleLog {
|
export class ConsoleLog {
|
||||||
public log(logLevelArg: plugins.smartlogInterfaces.TLogLevel, logMessageArg: string) {
|
public log(
|
||||||
|
logLevelArg: plugins.smartlogInterfaces.TLogLevel,
|
||||||
|
logMessageArg: string,
|
||||||
|
dataArg?: any,
|
||||||
|
correlationArg?: plugins.smartlogInterfaces.ILogCorrelation
|
||||||
|
) {
|
||||||
console.log(`__# ${logLevelArg}: ${logMessageArg}`);
|
console.log(`__# ${logLevelArg}: ${logMessageArg}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,15 @@ export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
|
|||||||
flags: 'a+'
|
flags: 'a+'
|
||||||
}); */
|
}); */
|
||||||
process.stdout.write = (...args) => {
|
process.stdout.write = (...args) => {
|
||||||
if (!args[0].startsWith('LOG')) {
|
const logString: string = args[0];
|
||||||
this.log('info', args[0]);
|
if (!logString.startsWith('LOG') && typeof logString === 'string') {
|
||||||
|
switch(true) {
|
||||||
|
case logString.substr(0, 20).includes('Error:'):
|
||||||
|
this.log('error', logString);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.log('info', logString);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// fileStream.write(args[0]);
|
// fileStream.write(args[0]);
|
||||||
@@ -53,7 +60,7 @@ export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
|
|||||||
|
|
||||||
process.stderr.write = (...args) => {
|
process.stderr.write = (...args) => {
|
||||||
if (!args[0].startsWith('LOG')) {
|
if (!args[0].startsWith('LOG')) {
|
||||||
this.log('info', args[0]);
|
this.log('error', args[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// fileStream.write(args[0]);
|
// fileStream.write(args[0]);
|
||||||
@@ -129,8 +136,8 @@ export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public handleLog(logPackageArg: plugins.smartlogInterfaces.ILogPackage) {
|
public async handleLog(logPackageArg: plugins.smartlogInterfaces.ILogPackage) {
|
||||||
this.logRouter.routeLog(logPackageArg);
|
await this.logRouter.routeLog(logPackageArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private safeConsoleLog(logLine: string) {
|
private safeConsoleLog(logLine: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user