now injects console.log
This commit is contained in:
parent
4eb1bf4fe1
commit
e7cc9b0e00
3
dist/beautylog.classes.ora.d.ts
vendored
3
dist/beautylog.classes.ora.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
export declare let isOraActive: boolean;
|
||||
export declare let oraActive: boolean;
|
||||
export declare let activeOra: Ora;
|
||||
export declare class Ora {
|
||||
private _oraObject;
|
||||
@ -9,6 +9,7 @@ export declare class Ora {
|
||||
end(): void;
|
||||
endOk(textArg: any): void;
|
||||
endError(textArg: any): void;
|
||||
pause(): void;
|
||||
stop(): void;
|
||||
log(logText: string, logType: string): void;
|
||||
}
|
||||
|
11
dist/beautylog.classes.ora.js
vendored
11
dist/beautylog.classes.ora.js
vendored
@ -2,7 +2,7 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./beautylog.plugins");
|
||||
var beautylog_log_helpers_1 = require("./beautylog.log.helpers");
|
||||
exports.isOraActive = false; // when an Ora is active (e.g. start()) this is true;
|
||||
exports.oraActive = false; // when an Ora is active (e.g. start()) this is true;
|
||||
var Ora = (function () {
|
||||
function Ora(textArg, colorArg, startArg) {
|
||||
if (startArg === void 0) { startArg = false; }
|
||||
@ -23,7 +23,7 @@ var Ora = (function () {
|
||||
if (colorArg)
|
||||
this._oraObject.color = colorArg;
|
||||
exports.activeOra = this;
|
||||
exports.isOraActive = true;
|
||||
exports.oraActive = true;
|
||||
this._oraObject.start();
|
||||
};
|
||||
;
|
||||
@ -31,7 +31,7 @@ var Ora = (function () {
|
||||
this._oraObject.stop();
|
||||
this._oraObject.clear();
|
||||
exports.activeOra = undefined;
|
||||
exports.isOraActive = false;
|
||||
exports.oraActive = false;
|
||||
};
|
||||
Ora.prototype.endOk = function (textArg) {
|
||||
this.end();
|
||||
@ -43,6 +43,9 @@ var Ora = (function () {
|
||||
beautylog_log_helpers_1.logNode(textArg, "error");
|
||||
};
|
||||
;
|
||||
Ora.prototype.pause = function () {
|
||||
this._oraObject.stop();
|
||||
};
|
||||
Ora.prototype.stop = function () {
|
||||
this.end();
|
||||
};
|
||||
@ -56,4 +59,4 @@ var Ora = (function () {
|
||||
}());
|
||||
exports.Ora = Ora;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5jbGFzc2VzLm9yYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNENBQTRDO0FBQzVDLElBQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFDL0Msc0NBQXNCLHlCQUF5QixDQUFDLENBQUE7QUFFckMsbUJBQVcsR0FBVyxLQUFLLENBQUMsQ0FBQyxxREFBcUQ7QUFHN0Y7SUFHSSxhQUFZLE9BQWMsRUFBQyxRQUFlLEVBQUMsUUFBd0I7UUFBeEIsd0JBQXdCLEdBQXhCLGdCQUF3QjtRQUMvRCxJQUFJLENBQUMsVUFBVSxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUM7WUFDMUIsT0FBTyxFQUFDLE1BQU07WUFDZCxJQUFJLEVBQUMsT0FBTztZQUNaLEtBQUssRUFBQyxRQUFRO1NBQ2pCLENBQUMsQ0FBQztRQUVILFFBQVEsR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssRUFBRSxHQUFHLEtBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUNqRCxDQUFDO0lBQ0Qsa0JBQUksR0FBSixVQUFLLE9BQU87UUFDUixJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksR0FBRyxPQUFPLENBQUM7SUFDbkMsQ0FBQzs7SUFFRCxtQkFBSyxHQUFMLFVBQU0sT0FBZSxFQUFDLFFBQWdCO1FBQ2xDLEVBQUUsQ0FBQSxDQUFDLE9BQU8sQ0FBQztZQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxHQUFHLE9BQU8sQ0FBQztRQUMzQyxFQUFFLENBQUEsQ0FBQyxRQUF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XG4gICAgc3RvcCgpeyAvLyBhbGlhcyBmb3IgZW5kXHJcbiAgICAgICAgdGhpcy5lbmQoKTtcclxuICAgIH1cclxuICAgIFxyXG4gICAgLy8gbG9nIG1ldGhvZHMgdGhhdCBwbGF5IG5pY2Ugd2l0aCBvcmFcclxuICAgIGxvZyhsb2dUZXh0OnN0cmluZyxsb2dUeXBlOnN0cmluZyl7XHJcbiAgICAgICAgdGhpcy5zdG9wKCk7XHJcbiAgICAgICAgbG9nTm9kZShsb2dUZXh0LGxvZ1R5cGUpO1xyXG4gICAgICAgIHRoaXMuc3RhcnQoKTtcclxuICAgIH1cclxufSJdfQ==
|
||||
|
8
dist/beautylog.console.d.ts
vendored
Normal file
8
dist/beautylog.console.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* routes the console to got through beautylog, so beautylog can take action before things are logged to console.
|
||||
*/
|
||||
export declare let route: (statusArg: boolean) => void;
|
||||
export declare let beautyConsole: {
|
||||
log2: (message?: any, ...optionalParams: any[]) => void;
|
||||
log: (logArg: any) => void;
|
||||
};
|
29
dist/beautylog.console.js
vendored
Normal file
29
dist/beautylog.console.js
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
var beautylog_classes_ora_1 = require("./beautylog.classes.ora");
|
||||
var nativeLog = console.log;
|
||||
/**
|
||||
* routes the console to got through beautylog, so beautylog can take action before things are logged to console.
|
||||
*/
|
||||
exports.route = function (statusArg) {
|
||||
if (statusArg == true) {
|
||||
console.log = exports.beautyConsole.log;
|
||||
}
|
||||
else {
|
||||
console.log = nativeLog;
|
||||
}
|
||||
};
|
||||
exports.beautyConsole = {
|
||||
log2: nativeLog,
|
||||
log: function (logArg) {
|
||||
if (beautylog_classes_ora_1.oraActive) {
|
||||
beautylog_classes_ora_1.activeOra.pause();
|
||||
nativeLog.apply(nativeLog, arguments);
|
||||
beautylog_classes_ora_1.activeOra.start();
|
||||
}
|
||||
else {
|
||||
nativeLog.apply(nativeLog, arguments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aXZlTG9nLmFwcGx5KG5hdGl2ZUxvZywgYXJndW1lbnRzKTtcclxuICAgICAgICB9XHJcbiAgICB9XHJcbn0iXX0=
|
13
dist/beautylog.log.helpers.js
vendored
13
dist/beautylog.log.helpers.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -16,4 +16,4 @@ exports.ok = BeautylogLog.ok;
|
||||
exports.success = BeautylogLog.success;
|
||||
exports.warn = BeautylogLog.warn;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0Qzs7QUFHNUMsSUFBWSxZQUFZLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUNoRCxJQUFZLGVBQWUsV0FBTSxvQkFFakMsQ0FBQyxDQUZvRDtBQUVyRCx3Q0FBb0IsMkJBQTJCLENBQUM7QUFBeEMsZ0RBQXdDO0FBQ2hELHNDQUFrQix5QkFBeUIsQ0FBQztBQUFwQywwQ0FBb0M7QUFFakMsV0FBRyxHQUFJLFlBQVksQ0FBQyxHQUFHLENBQUM7QUFDeEIsYUFBSyxHQUFJLFlBQVksQ0FBQyxLQUFLLENBQUM7QUFDNUIsY0FBTSxHQUFJLGVBQWUsQ0FBQyxNQUFNLENBQUM7QUFDakMsa0JBQVUsR0FBSSxlQUFlLENBQUMsVUFBVSxDQUFDO0FBQ3pDLFlBQUksR0FBSSxZQUFZLENBQUMsSUFBSSxDQUFDO0FBQzFCLFdBQUcsR0FBSSxZQUFZLENBQUMsR0FBRyxDQUFDO0FBQ3hCLFVBQUUsR0FBSSxZQUFZLENBQUMsRUFBRSxDQUFDO0FBQ3RCLGVBQU8sR0FBSSxZQUFZLENBQUMsT0FBTyxDQUFDO0FBQ2hDLFlBQUksR0FBSSxZQUFZLENBQUMsSUFBSSxDQUFDIiwiZmlsZSI6ImluZ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LmZpZ2xldFwiXHJcbmltcG9ydCAqIGFzIEJlYXV0eWxvZ0NvbnNvbGUgZnJvbSBcIi4vYmVhdXR5bG9nLmNvbnNvbGVcIjtcclxuXHJcbmV4cG9ydCB7VGFibGV9IGZyb20gXCIuL2JlYXV0eWxvZy5jbGFzc2VzLnRhYmxlXCI7XHJcbmV4cG9ydCB7T3JhfSBmcm9tIFwiLi9iZWF1dHlsb2cuY2xhc3Nlcy5vcmFcIjtcclxuXHJcbmV4cG9ydCBsZXQgZGlyID0gIEJlYXV0eWxvZ0xvZy5kaXI7XHJcbmV4cG9ydCBsZXQgZXJyb3IgPSAgQmVhdXR5bG9nTG9nLmVycm9yO1xyXG5leHBvcnQgbGV0IGZpZ2xldCA9ICBCZWF1dHlsb2dGaWdsZXQuZmlnbGV0O1xyXG5leHBvcnQgbGV0IGZpZ2xldFN5bmMgPSAgQmVhdXR5bG9nRmlnbGV0LmZpZ2xldFN5bmM7XHJcbmV4cG9ydCBsZXQgaW5mbyA9ICBCZWF1dHlsb2dMb2cuaW5mbztcclxuZXhwb3J0IGxldCBsb2cgPSAgQmVhdXR5bG9nTG9nLmxvZztcclxuZXhwb3J0IGxldCBvayA9ICBCZWF1dHlsb2dMb2cub2s7XHJcbmV4cG9ydCBsZXQgc3VjY2VzcyA9ICBCZWF1dHlsb2dMb2cuc3VjY2VzcztcclxuZXhwb3J0IGxldCB3YXJuID0gIEJlYXV0eWxvZ0xvZy53YXJuO1xyXG4iXX0=
|
||||
|
@ -2,7 +2,7 @@
|
||||
import * as plugins from "./beautylog.plugins";
|
||||
import {logNode} from "./beautylog.log.helpers";
|
||||
|
||||
export let isOraActive:boolean = false; // when an Ora is active (e.g. start()) this is true;
|
||||
export let oraActive:boolean = false; // when an Ora is active (e.g. start()) this is true;
|
||||
export let activeOra:Ora; //points to the currently active Ora object
|
||||
|
||||
export class Ora {
|
||||
@ -25,14 +25,14 @@ export class Ora {
|
||||
if(textArg) this._oraObject.text = textArg;
|
||||
if(colorArg) this._oraObject.color = colorArg;
|
||||
activeOra = this;
|
||||
isOraActive = true;
|
||||
oraActive = true;
|
||||
this._oraObject.start();
|
||||
};
|
||||
end(){
|
||||
this._oraObject.stop();
|
||||
this._oraObject.clear();
|
||||
activeOra = undefined;
|
||||
isOraActive = false;
|
||||
oraActive = false;
|
||||
}
|
||||
endOk(textArg){
|
||||
this.end();
|
||||
@ -42,6 +42,9 @@ export class Ora {
|
||||
this.end();
|
||||
logNode(textArg,"error");
|
||||
};
|
||||
pause(){
|
||||
this._oraObject.stop();
|
||||
}
|
||||
stop(){ // alias for end
|
||||
this.end();
|
||||
}
|
||||
|
29
ts/beautylog.console.ts
Normal file
29
ts/beautylog.console.ts
Normal file
@ -0,0 +1,29 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./beautylog.plugins");
|
||||
import {activeOra,oraActive} from "./beautylog.classes.ora";
|
||||
let nativeLog = console.log;
|
||||
|
||||
/**
|
||||
* routes the console to got through beautylog, so beautylog can take action before things are logged to console.
|
||||
*/
|
||||
export let route = function(statusArg:boolean){
|
||||
if(statusArg == true){
|
||||
console.log = beautyConsole.log;
|
||||
} else {
|
||||
console.log = nativeLog;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export let beautyConsole = {
|
||||
log2: nativeLog,
|
||||
log: function(logArg:any){
|
||||
if(oraActive){
|
||||
activeOra.pause();
|
||||
nativeLog.apply(nativeLog, arguments);
|
||||
activeOra.start();
|
||||
} else {
|
||||
nativeLog.apply(nativeLog, arguments);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
|
||||
import plugins = require("./beautylog.plugins");
|
||||
import {isOraActive,activeOra} from "./beautylog.classes.ora";
|
||||
import * as plugins from "./beautylog.plugins";
|
||||
import {beautyConsole} from "./beautylog.console";
|
||||
|
||||
var localBl = {
|
||||
dirPrefix: plugins.clc.bgXterm(39).xterm(231).bold(' DIR ') + ' ',
|
||||
@ -22,11 +22,7 @@ var localBl = {
|
||||
export let log = function(logText:string = 'empty log', logType:string = 'normal') {
|
||||
switch(plugins.smartenv.getEnv().runtimeEnv) {
|
||||
case "node":
|
||||
if (isOraActive){
|
||||
activeOra.log(logText,logType);
|
||||
} else {
|
||||
logNode(logText,logType);
|
||||
}
|
||||
logNode(logText,logType);
|
||||
break;
|
||||
case "browser":
|
||||
logBrowser(logText,logType);
|
||||
@ -69,7 +65,7 @@ export let logNode = function(logText:string,logType:string){
|
||||
console.log(('unknown logType for "' + logText + '"').red.bold);
|
||||
break;
|
||||
}
|
||||
console.log(logText);
|
||||
beautyConsole.log(logText);
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
import * as plugins from "./beautylog.plugins";
|
||||
import * as BeautylogLog from "./beautylog.log";
|
||||
import * as BeautylogFiglet from "./beautylog.figlet"
|
||||
import * as BeautylogConsole from "./beautylog.console";
|
||||
|
||||
export {Table} from "./beautylog.classes.table";
|
||||
export {Ora} from "./beautylog.classes.ora";
|
||||
|
Loading…
Reference in New Issue
Block a user