Compare commits

...

74 Commits

Author SHA1 Message Date
c9e92e9549 update description 2024-05-29 14:14:18 +02:00
0309e037a0 9.0.2 2024-04-24 18:30:06 +02:00
872385dbc4 fix(core): update 2024-04-24 18:30:06 +02:00
922591d45d update tsconfig 2024-04-14 17:51:52 +02:00
a39a2bdfa8 update npmextra.json: githost 2024-04-01 21:36:09 +02:00
93128628cc update npmextra.json: githost 2024-04-01 19:58:46 +02:00
023b3ff377 update npmextra.json: githost 2024-03-30 21:47:45 +01:00
8e3f65061a switch to new org scheme 2023-07-10 10:02:44 +02:00
1f9bfcc856 9.0.1 2023-07-09 17:38:18 +02:00
04686b810f fix(core): update 2023-07-09 17:38:18 +02:00
f9afc486f3 9.0.0 2022-10-26 18:41:30 +02:00
ce6bdb984c BREAKING CHANGE(core): switch to esm 2022-10-26 18:41:30 +02:00
10fa0af94c 8.0.9 2022-10-26 18:41:05 +02:00
0a3f6da174 fix(core): update 2022-10-26 18:41:04 +02:00
9073d9a7f8 8.0.8 2020-06-11 10:38:37 +00:00
890cd463d5 fix(core): update 2020-06-11 10:38:37 +00:00
186766df3d 8.0.7 2020-06-11 10:38:19 +00:00
62ff7ec717 fix(core): update 2020-06-11 10:38:19 +00:00
ca3286625d 8.0.6 2020-06-11 10:35:21 +00:00
ff33c9597a fix(core): update 2020-06-11 10:35:20 +00:00
65604d4ec0 8.0.5 2020-06-05 10:29:06 +00:00
f83c8feb3e fix(core): update 2020-06-05 10:29:06 +00:00
2b7a4ff07a 8.0.4 2020-06-05 09:35:43 +00:00
1c59952bb5 fix(core): update 2020-06-05 09:35:42 +00:00
bb48d3cb04 8.0.3 2020-06-05 02:01:12 +00:00
64a555748e fix(core): update 2020-06-05 02:01:12 +00:00
34fd838e80 8.0.2 2019-06-07 12:05:45 +02:00
b48b2a77b0 fix(tests): let -> const 2019-06-07 12:05:44 +02:00
99c2c2e84f 8.0.1 2019-06-07 12:02:01 +02:00
bf791d732c fix(core): cleaned up dev dependencies 2019-06-07 12:02:01 +02:00
e5e7f00353 8.0.0 2019-06-07 12:00:59 +02:00
78bd0605aa BREAKING CHANGE(ora): remove support for ora which is now handled in smartlog-source-ora 2019-06-07 12:00:58 +02:00
f1e3ca6014 7.0.5 2018-11-10 23:29:36 +01:00
0712d47155 fix(dependencies): remove smartenv 2018-11-10 23:29:35 +01:00
2a9b686e94 7.0.4 2018-11-04 18:23:41 +01:00
a9180878d5 fix(core): update 2018-11-04 18:23:41 +01:00
4a1214a87f 7.0.3 2018-11-04 13:36:50 +01:00
d85878713e fix(package.json): update author 2018-11-04 13:36:49 +01:00
9d65e37a60 7.0.2 2018-11-04 13:26:56 +01:00
5dd07e34ed fix(core): update 2018-11-04 13:26:56 +01:00
ba7727dc55 7.0.1 2018-11-04 13:22:45 +01:00
7c85387c85 fix(core): update 2018-11-04 13:22:45 +01:00
c978ada06c fix(structure): update smartlog compatibility 2018-07-05 23:40:33 +02:00
ca749d45b1 update 2018-07-04 23:11:03 +02:00
89efae2eb7 7.0.0 2018-07-04 22:50:47 +02:00
5da96c42c6 BREAKING CHANGE(package.json): switch scope and name to smartlog-destination-local 2018-07-04 22:50:46 +02:00
127476c86e system change 2018-03-03 13:57:55 +01:00
7c1eb711da 6.1.12 2018-03-01 01:06:20 +01:00
0edaa51679 update to latest standards 2018-03-01 01:06:12 +01:00
db46fca769 6.1.11 2017-08-28 13:14:42 +02:00
824efb1fc8 update ci 2017-08-28 13:14:35 +02:00
9d386f7c45 6.1.10 2017-04-22 13:38:44 +02:00
be3bdde24b fix ci 2017-04-22 13:38:40 +02:00
271fd4817e 6.1.9 2017-04-22 13:30:23 +02:00
5288a1583d fix ci 2017-04-22 13:30:20 +02:00
21979e431d fix docs 2017-04-22 13:26:11 +02:00
fdd3498d78 fix README 2017-04-22 13:25:46 +02:00
f93317bd02 6.1.8 2017-04-22 13:24:16 +02:00
0e0a8dfebd fix README 2017-04-22 13:24:08 +02:00
06c29f97b1 6.1.7 2017-04-22 13:23:05 +02:00
8e3dc5b003 update docs 2017-04-22 13:22:56 +02:00
07d19416fd update readme 2017-04-21 23:59:21 +02:00
2c011ae852 6.1.6 2017-04-21 23:39:28 +02:00
b6c0b17ef8 update README 2017-04-21 23:38:51 +02:00
f72f5a0765 update ci 2017-03-11 17:43:10 +01:00
b6d6766c91 add npmextra.json 2017-03-11 15:47:34 +01:00
7b238535c8 update gitlab ci 2017-03-11 15:11:37 +01:00
0b94ab3a04 6.1.5 2017-03-11 12:31:42 +01:00
224ed76018 6.1.4 2017-03-11 12:30:20 +01:00
382d00cfa6 fix remote logging 2017-03-11 12:30:18 +01:00
f6b9e7a4db 6.1.3 2017-03-10 19:27:25 +01:00
ffe65ff1bc update README 2017-03-10 19:26:45 +01:00
6eb2f8d623 6.1.2 2017-03-10 10:52:38 +01:00
0244885479 update README 2017-03-10 10:52:35 +01:00
53 changed files with 5602 additions and 26542 deletions

26
.gitignore vendored
View File

@ -1,10 +1,20 @@
node_modules/
coverage/
pages/
public/
npm-debug.log
.nogit/
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

View File

@ -1,49 +1,128 @@
image: hosttoday/ht-docker-node:npmts
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- test
- release
- page
- security
- test
- release
- metadata
testLEGACY:
before_script:
- pnpm install -g pnpm
- pnpm install -g @shipzone/npmci
- npmci npm prepare
# ====================
# security stage
# ====================
# ====================
# security stage
# ====================
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --prod
tags:
- lossless
- docker
allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --dev
tags:
- lossless
- docker
allow_failure: true
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci test legacy
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testLTS:
testBuild:
stage: test
script:
- npmci test lts
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci publish
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g typescript
- npmci npm prepare
- npmci npm install
tags:
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmpage
stage: page
stage: metadata
script:
- npmci test stable
- npmci command npmpage --host gitlab
- npmci node install stable
- npmci npm install
- npmci command npm run buildDocs
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
- public
allow_failure: true

11
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,61 +0,0 @@
# beautylog
beautiful logging, TypeScript ready
## Availabililty
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/beautylog)
[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/beautylog)
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/beautylog)
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/beautylog/docs)
[![docs](https://push.rocks/assets/repo-button-api.svg)](https://pushrocks.gitlab.io/beautylog/api)
## Status for master
[![build status](https://gitlab.com/pushrocks/beautylog/badges/master/build.svg)](https://gitlab.com/pushrocks/beautylog/commits/master)
[![coverage report](https://gitlab.com/pushrocks/beautylog/badges/master/coverage.svg)](https://gitlab.com/pushrocks/beautylog/commits/master)
[![Dependency Status](https://david-dm.org/pushrocks/beautylog.svg)](https://david-dm.org/pushrocks/beautylog)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/beautylog/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/beautylog/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/beautylog/badges/code.svg)](https://www.bithound.io/github/pushrocks/beautylog)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
## Usage
```typescript
import * as beautylog from 'beautylog'
beautylog.log('some log message') // normal console log message
beautylog.info('some log message') // info console log message
beautylog.ok('some log message') // ok console log message
beautylog.warn('some log message') // warn console log message
beautylog.success('some success message') // success console log message
beautylog.error('some error message') // error console log message
```
### Ora Integration
beautylog wraps the excellent ora module from npm to better work with beautylog. In general that means that you can log persistent messages WHILE you are actually having an active Ora object. beautylog handles all the fuss for you.
```typescript
beautylog.ora.start('Hi, this is some text!', 'blue')
beautylog.info('some persistent text') //does not disturb ora
console.log('something') // even this works because console.log is monkeypatched by beautylog
beautylog.ora.text('some updated text') // switches the text
beautylog.ora.stop()
```
## Centralized remote logging
Beautylog makes it easy to have all your node applications log to a remote location.
```typescript
import { Loggly } from 'beautyremote'
let myLogglyRemote = new Loggly({
token: 'my_super_long_token_here'
})
beautylog.registerRemote(myLogglyRemote)
```
> Note: Beautylog monkeypatches all console log methods.
There is no need to change anything in your code.
Everything that is getting logged to your console by node will get logged to a remote as well.
For more information read the docs!
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)

View File

@ -1,16 +0,0 @@
import 'typings-global';
export declare let oraActive: boolean;
export declare let activeOra: Ora;
export declare class Ora {
state: string;
private _oraObject;
constructor(textArg: string, colorArg: string, startArg?: boolean);
text(textArg: any): void;
start(textArg?: string, colorArg?: string): void;
end(): void;
endOk(textArg: any): void;
endError(textArg: any): void;
pause(): void;
stop(): void;
}
export declare let ora: Ora;

View File

@ -1,54 +0,0 @@
"use strict";
require("typings-global");
const plugins = require("./beautylog.plugins");
const beautylog_log_helpers_1 = require("./beautylog.log.helpers");
exports.oraActive = false; // when an Ora is active (e.g. start()) this is true
class Ora {
constructor(textArg, colorArg, startArg = false) {
this._oraObject = plugins.ora({
spinner: 'dots',
text: textArg,
color: colorArg
});
if (startArg) {
this.start();
}
}
text(textArg) {
this._oraObject.text = textArg;
}
start(textArg, colorArg) {
if (textArg) {
this.text(textArg);
}
if (colorArg) {
this._oraObject.color = colorArg;
}
exports.activeOra = this;
exports.oraActive = true;
this._oraObject.start();
}
end() {
this._oraObject.stop();
this._oraObject.clear();
exports.activeOra = undefined;
exports.oraActive = false;
}
endOk(textArg) {
this.end();
beautylog_log_helpers_1.logNode('ok', textArg);
}
endError(textArg) {
this.end();
beautylog_log_helpers_1.logNode('error', textArg);
}
pause() {
this._oraObject.stop();
}
stop() {
this.end();
}
}
exports.Ora = Ora;
exports.ora = new Ora('init...', 'blue', false);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNsYXNzZXMub3JhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYmVhdXR5bG9nLmNsYXNzZXMub3JhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7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FJLEVBQUUsQ0FBQTtRQUN0QixJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssRUFBRSxDQUFBO1FBQ3ZCLGlCQUFTLEdBQUcsU0FBUyxDQUFBO1FBQ3JCLGlCQUFTLEdBQUcsS0FBSyxDQUFBO0lBQ3JCLENBQUM7SUFDRCxLQUFLLENBQUMsT0FBTztRQUNULElBQUksQ0FBQyxHQUFHLEVBQUUsQ0FBQTtRQUNWLCtCQUFPLENBQUMsSUFBSSxFQUFDLE9BQU8sQ0FBQyxDQUFBO0lBQ3pCLENBQUM7SUFDRCxRQUFRLENBQUMsT0FBTztRQUNaLElBQUksQ0FBQyxHQUFHLEVBQUUsQ0FBQTtRQUNWLCtCQUFPLENBQUMsT0FBTyxFQUFDLE9BQU8sQ0FBQyxDQUFBO0lBQzVCLENBQUM7SUFDRCxLQUFLO1FBQ0QsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLEVBQUUsQ0FBQTtJQUMxQixDQUFDO0lBQ0QsSUFBSTtRQUNBLElBQUksQ0FBQyxHQUFHLEVBQUUsQ0FBQTtJQUNkLENBQUM7Q0FDSjtBQTVDRCxrQkE0Q0M7QUFFVSxRQUFBLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxTQUFTLEVBQUUsTUFBTSxFQUFFLEtBQUssQ0FBQyxDQUFBIn0=

View File

@ -1,5 +0,0 @@
import 'typings-global';
export declare let beautyConsole: {
log: (logArg: any) => void;
error: () => void;
};

View File

@ -1,41 +0,0 @@
"use strict";
require("typings-global");
const beautylog_classes_ora_1 = require("./beautylog.classes.ora");
let nativeLog = console.log;
let nativeError = console.error;
/**
* routes the console to got through beautylog, so beautylog can take action before things are logged to console.
*/
let route = function (statusArg) {
if (statusArg === true) {
console.log = exports.beautyConsole.log;
console.error = exports.beautyConsole.error;
}
else {
console.log = nativeLog;
}
};
exports.beautyConsole = {
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);
}
},
error: function () {
if (beautylog_classes_ora_1.oraActive) {
beautylog_classes_ora_1.activeOra.pause();
nativeLog.apply(nativeError, arguments);
beautylog_classes_ora_1.activeOra.start();
}
else {
nativeLog.apply(nativeError, arguments);
}
}
};
route(true);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNvbnNvbGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlsb2cuY29uc29sZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBRXZCLG1FQUE4RDtBQUM5RCxJQUFJLFNBQVMsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFBO0FBQzNCLElBQUksV0FBVyxHQUFHLE9BQU8sQ0FBQyxLQUFLLENBQUE7QUFFL0I7O0dBRUc7QUFDSCxJQUFJLEtBQUssR0FBRyxVQUFTLFNBQWtCO0lBQ25DLEVBQUUsQ0FBQyxDQUFDLFNBQVMsS0FBSyxJQUFJLENBQUMsQ0FBQyxDQUFDO1FBQ3JCLE9BQU8sQ0FBQyxHQUFHLEdBQUcscUJBQWEsQ0FBQyxHQUFHLENBQUE7UUFDL0IsT0FBTyxDQUFDLEtBQUssR0FBRyxxQkFBYSxDQUFDLEtBQUssQ0FBQTtJQUN2QyxDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixPQUFPLENBQUMsR0FBRyxHQUFHLFNBQVMsQ0FBQTtJQUMzQixDQUFDO0FBQ0wsQ0FBQyxDQUFBO0FBRVUsUUFBQSxhQUFhLEdBQUc7SUFDdkIsR0FBRyxFQUFFLFVBQVMsTUFBVztRQUNyQixFQUFFLENBQUMsQ0FBQyxpQ0FBUyxDQUFDLENBQUMsQ0FBQztZQUNaLGlDQUFTLENBQUMsS0FBSyxFQUFFLENBQUE7WUFDakIsU0FBUyxDQUFDLEtBQUssQ0FBQyxTQUFTLEVBQUUsU0FBUyxDQUFDLENBQUE7WUFDckMsaUNBQVMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUNyQixDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDSixTQUFTLENBQUMsS0FBSyxDQUFDLFNBQVMsRUFBRSxTQUFTLENBQUMsQ0FBQTtRQUN6QyxDQUFDO0lBQ0wsQ0FBQztJQUNELEtBQUssRUFBRTtRQUNILEVBQUUsQ0FBQyxDQUFDLGlDQUFTLENBQUMsQ0FBQyxDQUFDO1lBQ1osaUNBQVMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtZQUNqQixTQUFTLENBQUMsS0FBSyxDQUFDLFdBQVcsRUFBRSxTQUFTLENBQUMsQ0FBQTtZQUN2QyxpQ0FBUyxDQUFDLEtBQUssRUFBRSxDQUFBO1FBQ3JCLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNKLFNBQVMsQ0FBQyxLQUFLLENBQUMsV0FBVyxFQUFFLFNBQVMsQ0FBQyxDQUFBO1FBQzNDLENBQUM7SUFDTCxDQUFDO0NBQ0osQ0FBQTtBQUVELEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQSJ9

View File

@ -1,9 +0,0 @@
import 'typings-global';
import plugins = require('./beautylog.plugins');
export interface IFigletOptions {
font?: string;
color?: plugins.beautycolor.TColorName;
cb?: any;
}
export declare let figlet: (textArg: string, optionsArg?: any) => Promise<{}>;
export declare let figletSync: (textArg: string, optionsArg?: IFigletOptions) => boolean;

View File

@ -1,49 +0,0 @@
"use strict";
require("typings-global");
const plugins = require("./beautylog.plugins");
let defaultOptions = {
font: 'Star Wars',
color: 'green',
cb: function () { }
};
exports.figlet = function (textArg, optionsArg) {
let done = plugins.q.defer();
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
let options = plugins.lodash.assign(mergeOptions, optionsArg);
plugins.figlet(textArg, {
font: options.font,
horizontalLayout: 'default',
verticalLayout: 'default'
}, function (err, data) {
if (err) {
console.log('Something went wrong...');
console.dir(err);
return;
}
console.log(colorFiglet(data, options.color));
options.cb();
done.resolve();
});
return done.promise;
};
exports.figletSync = function (textArg, optionsArg) {
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
let options = plugins.lodash.assign(mergeOptions, optionsArg);
let figletString = plugins.figlet.textSync(textArg, {
font: options.font,
horizontalLayout: 'default',
verticalLayout: 'default'
});
console.log(colorFiglet(figletString, options.color));
return true;
};
let colorFiglet = (figletStringArg, colorArg) => {
let figletArray = figletStringArg.split('\n');
let figletStringCombined = '';
for (let figletRow of figletArray) {
figletRow = plugins.beautycolor.coloredString(figletRow, colorArg);
figletStringCombined = figletStringCombined + figletRow + '\n';
}
return figletStringCombined;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmZpZ2xldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5maWdsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUN2QiwrQ0FBK0M7QUFRL0MsSUFBSSxjQUFjLEdBQW1CO0lBQ2pDLElBQUksRUFBRSxXQUFXO0lBQ2pCLEtBQUssRUFBRSxPQUFPO0lBQ2QsRUFBRSxFQUFFLGNBQVksQ0FBQztDQUNwQixDQUFBO0FBRVUsUUFBQSxNQUFNLEdBQUcsVUFBUyxPQUFlLEVBQUUsVUFBVztJQUNyRCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFBO0lBQzVCLElBQUksWUFBWSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLGNBQWMsQ0FBQyxDQUFBO0lBQzNELElBQUksT0FBTyxHQUFHLE9BQU8sQ0FBQyxNQ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yxFQUFDO1FBQ3ZELElBQUksRUFBRSxPQUFPLENBQUMsSUFBSTtRQUNsQixnQkFBZ0IsRUFBRSxTQUFTO1FBQzNCLGNBQWMsRUFBRSxTQUFTO0tBQzVCLENBQUMsQ0FBQTtJQUNGLE9BQU8sQ0FBQyxHQUFHLENBQUMsV0FBVyxDQUFDLFlBQVksRUFBRSxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQTtJQUNyRCxNQUFNLENBQUMsSUFBSSxDQUFBO0FBQ2YsQ0FBQyxDQUFBO0FBRUQsSUFBSSxXQUFXLEdBQUcsQ0FBQyxlQUFlLEVBQUUsUUFBd0M7SUFDeEUsSUFBSSxXQUFXLEdBQUcsZUFBZSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQTtJQUM3QyxJQUFJLG9CQUFvQixHQUFHLEVBQUUsQ0FBQTtJQUM3QixHQUFHLENBQUMsQ0FBQyxJQUFJLFNBQVMsSUFBSSxXQUFZLENBQUMsQ0FBQyxDQUFDO1FBQ2pDLFNBQVMsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLGFBQWEsQ0FBQyxTQUFTLEVBQUUsUUFBUSxDQUFDLENBQUE7UUFDbEUsb0JBQW9CLEdBQUcsb0JBQW9CLEdBQUcsU0FBUyxHQUFHLElBQUksQ0FBQTtJQUNsRSxDQUFDO0lBQ0QsTUFBTSxDQUFDLG9CQUFvQixDQUFBO0FBQy9CLENBQUMsQ0FBQSJ9

View File

@ -1,52 +0,0 @@
import 'typings-global';
/**
* logs an info to console
* @param logText
* @returns {boolean}
*/
export declare let log: (logText: any) => void;
export declare let info: (logText: any) => void;
/**
* logs an 'OK!' message to console
* @param logText
* @returns {boolean}
*/
export declare let ok: (logText: any) => void;
/**
* logs a success to console
* @param logText string to log as error
* @returns {boolean}
*/
export declare let success: (logText: any) => void;
/**
* logs a 'warn:' message to console
* @param logText string to log as error
* @returns {boolean}
*/
export declare let warn: (logText: any) => void;
/**
* logs an error to console
* @param logText
* @returns {boolean}
*/
export declare let error: (logText: any) => void;
/**
* logs an directory to console
* @param logText
* @returns {boolean}
*/
export declare let dir: (logText: any) => void;
/**
* note
*/
export declare let note: (logText: any) => void;
/**
* creates a new empty line
* @param linesArg
* @returns void
*/
export declare let newLine: (linesArg?: number) => void;
/**
* logs a reduced log that only logs changes of consequential log messages
*/
export declare let logReduced: (logTextArg: string, repeatEveryTimesArg?: number) => void;

View File

@ -1,8 +0,0 @@
/**
*
* @param logText
* @param logType
* @returns {boolean}
*/
export declare let internalLog: (logType?: string, logText?: string) => void;
export declare let logNode: (logType: string, logText: string) => boolean;

File diff suppressed because one or more lines are too long

86
dist/beautylog.log.js vendored
View File

@ -1,86 +0,0 @@
"use strict";
require("typings-global");
const beautylog_log_helpers_1 = require("./beautylog.log.helpers");
/**
* logs an info to console
* @param logText
* @returns {boolean}
*/
exports.log = (logText) => {
return beautylog_log_helpers_1.internalLog('log', logText);
};
exports.info = (logText) => {
return beautylog_log_helpers_1.internalLog('info', logText);
};
/**
* logs an 'OK!' message to console
* @param logText
* @returns {boolean}
*/
exports.ok = (logText) => {
return beautylog_log_helpers_1.internalLog('ok', logText);
};
/**
* logs a success to console
* @param logText string to log as error
* @returns {boolean}
*/
exports.success = (logText) => {
return beautylog_log_helpers_1.internalLog('success', logText);
};
/**
* logs a 'warn:' message to console
* @param logText string to log as error
* @returns {boolean}
*/
exports.warn = (logText) => {
return beautylog_log_helpers_1.internalLog('warn', logText);
};
/**
* logs an error to console
* @param logText
* @returns {boolean}
*/
exports.error = (logText) => {
return beautylog_log_helpers_1.internalLog('error', logText);
};
/**
* logs an directory to console
* @param logText
* @returns {boolean}
*/
exports.dir = (logText) => {
return beautylog_log_helpers_1.internalLog('dir', logText);
};
/**
* note
*/
exports.note = (logText) => {
return beautylog_log_helpers_1.internalLog('note', logText);
};
/**
* creates a new empty line
* @param linesArg
* @returns void
*/
exports.newLine = (linesArg = 1) => {
for (let i = 0; i < linesArg; i++) {
console.log('\n');
}
};
/**
* logs a reduced log that only logs changes of consequential log messages
*/
exports.logReduced = (logTextArg, repeatEveryTimesArg = 0) => {
if (logTextArg === previousMessage && (repeatEveryTimesArg === 0 || sameMessageCounter !== repeatEveryTimesArg)) {
sameMessageCounter++;
}
else {
sameMessageCounter = 0;
previousMessage = logTextArg;
exports.log(logTextArg);
}
};
let previousMessage = '';
let sameMessageCounter = 0;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmxvZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5sb2cudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUV2QixtRUFBbUQ7QUFFbkQ7Ozs7R0FJRztBQUVRLFFBQUEsR0FBRyxHQUFHLENBQUMsT0FBTztJQUNyQixNQUFNLENBQUMsbUNBQVcsQ0FBQyxLQUFLLEVBQUMsT0FBTyxDQUFDLENBQUE7QUFDckMsQ0FBQyxDQUFBO0FBRVUsUUFBQSxJQUFJLEdBQUcsQ0FBQyxPQUFPO0lBQ3RCLE1BQU0sQ0FBQyxtQ0FBVyxDQUFDLE1BQU0sRUFBQyxPQUFPLENBQUMsQ0FBQTtBQUN0QyxDQUFDLENBQUE7QUFFRDs7OztHQUlHO0FBQ1EsUUFBQSxFQUFFLEdBQUcsQ0FBQyxPQUFPO0lBQ3BCLE1BQU0sQ0FBQyxtQ0FBVyxDQUFDLElBQUksRUFBQyxPQUFPLENBQUMsQ0FBQTtBQUNwQyxDQUFDLENBQUE7QUFFRDs7OztHQUlHO0FBQ1EsUUFBQSxPQUFPLEdBQUcsQ0FBQyxPQUFPO0lBQ3pCLE1BQU0sQ0FBQyxtQ0FBVyxDQUFDLFNBQVMsRUFBQyxPQUFPLENBQUMsQ0FBQTtBQUN6QyxDQUFDLENBQUE7QUFFRDs7OztHQUlHO0FBQ1EsUUFBQSxJQ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QUMsQ0FBQyxDQUFDLENBQUM7UUFDOUcsa0JBQWtCLEVBQUUsQ0FBQTtJQUN4QixDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixrQkFBa0IsR0FBRyxDQUFDLENBQUE7UUFDdEIsZUFBZSxHQUFHLFVBQVUsQ0FBQTtRQUM1QixXQUFHLENBQUMsVUFBVSxDQUFDLENBQUE7SUFDbkIsQ0FBQztBQUNMLENBQUMsQ0FBQTtBQUNELElBQUksZUFBZSxHQUFXLEVBQUUsQ0FBQTtBQUNoQyxJQUFJLGtCQUFrQixHQUFXLENBQUMsQ0FBQSJ9

View File

@ -1,8 +0,0 @@
import 'typings-global';
import * as beautycolor from 'beautycolor';
import * as lodash from 'lodash';
import * as smartenv from 'smartenv';
import * as q from 'smartq';
declare let figlet: any;
declare let ora: any;
export { beautycolor, lodash, smartenv, q, figlet, ora };

View File

@ -1,15 +0,0 @@
"use strict";
require("typings-global");
const beautycolor = require("beautycolor");
exports.beautycolor = beautycolor;
const lodash = require("lodash");
exports.lodash = lodash;
const smartenv = require("smartenv");
exports.smartenv = smartenv;
const q = require("smartq");
exports.q = q;
let figlet = require('figlet');
exports.figlet = figlet;
let ora = require('ora');
exports.ora = ora;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlsb2cucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBRXZCLDJDQUEwQztBQVF0QyxrQ0FBVztBQVBmLGlDQUFnQztBQVE1Qix3QkFBTTtBQVBWLHFDQUFvQztBQVFoQyw0QkFBUTtBQVBaLDRCQUEyQjtBQVF2QixjQUFDO0FBUEwsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFBO0FBUTFCLHdCQUFNO0FBUFYsSUFBSSxHQUFHLEdBQUcsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFBO0FBUXBCLGtCQUFHIn0=

View File

@ -1,4 +0,0 @@
/**
* registers a remote
*/
export declare let registerRemote: (remoteArg: any) => void;

View File

@ -1,9 +0,0 @@
"use strict";
const beautylog_remote_1 = require("./beautylog.remote");
/**
* registers a remote
*/
exports.registerRemote = (remoteArg) => {
beautylog_remote_1.remoteArray.push(remoteArg);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLnJlZ2lzdGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYmVhdXR5bG9nLnJlZ2lzdGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSx5REFBOEM7QUFFOUM7O0dBRUc7QUFDUSxRQUFBLGNBQWMsR0FBRyxDQUFDLFNBQWM7SUFDdkMsOEJBQVcsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7QUFDL0IsQ0FBQyxDQUFBIn0=

View File

@ -1,8 +0,0 @@
export interface ILogMethod {
(logType: string, logMessage: string): void;
}
export interface IBeautyRemote {
log: ILogMethod;
}
export declare let remoteArray: IBeautyRemote[];
export declare let remoteLog: (logType: string, logMessage: string) => void;

View File

@ -1,8 +0,0 @@
"use strict";
exports.remoteArray = [];
exports.remoteLog = (logType, logMessage) => {
for (let beautyremote of exports.remoteArray) {
beautyremote.log(logType, logMessage);
}
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLnJlbW90ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5yZW1vdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQVVXLFFBQUEsV0FBVyxHQUFvQixFQUFFLENBQUE7QUFFakMsUUFBQSxTQUFTLEdBQUcsQ0FBQyxPQUFlLEVBQUUsVUFBa0I7SUFDdkQsR0FBRyxDQUFDLENBQUMsSUFBSSxZQUFZLElBQUksbUJBQVcsQ0FBQyxDQUFDLENBQUM7UUFDbkMsWUFBWSxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsVUFBVSxDQUFDLENBQUE7SUFDekMsQ0FBQztBQUNMLENBQUMsQ0FBQSJ9

6
dist/index.d.ts vendored
View File

@ -1,6 +0,0 @@
import 'typings-global';
import './beautylog.console';
export { ora } from './beautylog.classes.ora';
export { dir, error, info, log, logReduced, note, ok, success, warn, newLine } from './beautylog.log';
export { figlet, figletSync } from './beautylog.figlet';
export { registerRemote } from './beautylog.register';

24
dist/index.js vendored
View File

@ -1,24 +0,0 @@
"use strict";
require("typings-global");
require("./beautylog.console");
// export classes
var beautylog_classes_ora_1 = require("./beautylog.classes.ora");
exports.ora = beautylog_classes_ora_1.ora;
// export methods
var beautylog_log_1 = require("./beautylog.log");
exports.dir = beautylog_log_1.dir;
exports.error = beautylog_log_1.error;
exports.info = beautylog_log_1.info;
exports.log = beautylog_log_1.log;
exports.logReduced = beautylog_log_1.logReduced;
exports.note = beautylog_log_1.note;
exports.ok = beautylog_log_1.ok;
exports.success = beautylog_log_1.success;
exports.warn = beautylog_log_1.warn;
exports.newLine = beautylog_log_1.newLine;
var beautylog_figlet_1 = require("./beautylog.figlet");
exports.figlet = beautylog_figlet_1.figlet;
exports.figletSync = beautylog_figlet_1.figletSync;
var beautylog_register_1 = require("./beautylog.register");
exports.registerRemote = beautylog_register_1.registerRemote;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLCtCQUE0QjtBQUc1QixpQkFBaUI7QUFDakIsaUVBQTZDO0FBQXBDLHNDQUFBLEdBQUcsQ0FBQTtBQUVaLGlCQUFpQjtBQUNqQixpREFBcUc7QUFBNUYsOEJBQUEsR0FBRyxDQUFBO0FBQUUsZ0NBQUEsS0FBSyxDQUFBO0FBQUUsK0JBQUEsSUFBSSxDQUFBO0FBQUUsOEJBQUEsR0FBRyxDQUFBO0FBQUUscUNBQUEsVUFBVSxDQUFBO0FBQUUsK0JBQUEsSUFBSSxDQUFBO0FBQUUsNkJBQUEsRUFBRSxDQUFBO0FBQUUsa0NBQUEsT0FBTyxDQUFBO0FBQUUsK0JBQUEsSUFBSSxDQUFBO0FBQUUsa0NBQUEsT0FBTyxDQUFBO0FBQzVFLHVEQUF1RDtBQUE5QyxvQ0FBQSxNQUFNLENBQUE7QUFBRSx3Q0FBQSxVQUFVLENBQUE7QUFDM0IsMkRBQXFEO0FBQTVDLDhDQUFBLGNBQWMsQ0FBQSJ9

View File

@ -1,15 +0,0 @@
{
"structure": {
"readme": "index.md"
},
"plugins": [
"tonic",
"edit-link"
],
"pluginsConfig": {
"edit-link": {
"base": "https://gitlab.com/pushrocks/beautylog/edit/master/docs/",
"label": "Edit on GitLab"
}
}
}

View File

@ -1,101 +1,74 @@
# beautylog
beautiful logging, TypeScript ready
## Availabililty
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/beautylog)
[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/beautylog)
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/beautylog)
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/beautylog/docs)
[![docs](https://push.rocks/assets/repo-button-api.svg)](https://pushrocks.gitlab.io/beautylog/api)
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/beautylog)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/beautylog)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/beautylog)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/beautylog/)
## Status for master
[![build status](https://gitlab.com/pushrocks/beautylog/badges/master/build.svg)](https://gitlab.com/pushrocks/beautylog/commits/master)
[![coverage report](https://gitlab.com/pushrocks/beautylog/badges/master/coverage.svg)](https://gitlab.com/pushrocks/beautylog/commits/master)
[![build status](https://GitLab.com/pushrocks/beautylog/badges/master/build.svg)](https://GitLab.com/pushrocks/beautylog/commits/master)
[![coverage report](https://GitLab.com/pushrocks/beautylog/badges/master/coverage.svg)](https://GitLab.com/pushrocks/beautylog/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/beautylog.svg)](https://www.npmjs.com/package/beautylog)
[![Dependency Status](https://david-dm.org/pushrocks/beautylog.svg)](https://david-dm.org/pushrocks/beautylog)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/beautylog/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/beautylog/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/beautylog/badges/code.svg)](https://www.bithound.io/github/pushrocks/beautylog)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Quick Demo
[![asciicast](https://asciinema.org/a/46djsde96ecsho9wqibjx2zye.png)](https://asciinema.org/a/46djsde96ecsho9wqibjx2zye)
## Usage
```typescript
import * as beautylog from "beautylog";
Use TypeScript for best in class instellisense.
beautylog.log("some log message"); // normal console log message
beautylog.info("some log message") // info console log message
beautylog.ok("some log message"); // ok console log message
beautylog.warn("some log message"); // warn console log message
beautylog.success("some success message"); // success console log message
beautylog.error("some error message"); // error console log message
```javascript
beautylog.log('some log message'); // normal console log message
beautylog.info('some log message'); // info console log message
beautylog.ok('some log message'); // ok console log message
beautylog.warn('some log message'); // warn console log message
beautylog.success('some success message'); // success console log message
beautylog.error('some error message'); // error console log message
```
The plugin produces beautiful output like this:
![console.png](https://mediaserve.lossless.digital/github.com/pushrocks/beautylog/console.png)
### Ora Integration
beautylog wraps the excellent ora module from npm to better work with beautylog. In general that means that you can log persistent messages WHILE you are actually having an active Ora object. beautylog handles all the fuss for you.
```typescript
var myOra = new beautylog.Ora("my awesome text", "blue");
myOra.start();
beautylog.info("some persistent text") //does not disturb myOra
console.log("something") // even this works because console.log is monkeypatched by beautylog
myOra.text("some updated text");
myOra.stop();
```
### Console Tables
beautylog allows displaying data in nice tables for better overview.
> **Note:** This only works only in nodejs for now.
There are different types of tables.
#### Custom
```javascript
var beautylog = require("beautylog");
var myTable = beautylog.table.new("custom",["Heading1".blue,"Heading2".blue,"Heading3".blue]); // type "custom"
myTable.push(["check 1","success"]); // adds a row the myTable
myTable.push(["check 2","error"]); // adds a row the myTable
myTable.push(["check 3","error"]); // adds a row the myTable
myTable.print(); //prints myTable to the console
beautylog.ora.start('Hi, this is some text!', 'blue');
beautylog.info('some persistent text'); //does not disturb ora
console.log('something'); // even this works because console.log is monkeypatched by beautylog
beautylog.ora.text('some updated text'); // switches the text
beautylog.ora.stop();
```
#### Checks
```javascript
var beautylog = require("beautylog");
var myTable = beautylog.table.new("checks"); // type checks
myTable.push(["check 1","success"]); // adds a row to myTable
myTable.push(["check 2","error"]); // adds a row to myTable
myTable.push(["check 3","error"]); // adds a row to myTable
myTable.print(); //prints myTable to console
```
The table from the code with type "checks" above looks like this:
![table.png](https://mediaserve.lossless.digital/github.com/pushrocks/beautylog/table.png)
## Centralized remote logging
Beautylog makes it easy to have all your node applications log to a remote location.
Currently supported remote providers:
* loggly.com
```typescript
beautylog.remote.loggly({
token: "loggly-token",
subdomain: "loggly-subdomain",
appName: "some App Name",
serverName: "some Server Name"
```javascript
import { Loggly } from 'beautyremote';
let myLogglyRemote = new Loggly({
token: 'my_super_long_token_here',
});
beautylog.registerRemote(myLogglyRemote);
```
> Note: since beautylog monkeypatches all console log methods.
There is no need to change anything in your code.
Everything that is getting logged to your console by node will get logged to loggly as well.
> Note: Beautylog monkeypatches all console log methods.
> There is no need to change anything in your code.
> Everything that is getting logged to your console by node will get logged to a remote as well.
For more information read the docs!
For further information read the linked docs at the top of this README.
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015 Push.Rocks
Copyright (c) 2015 Lossless GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

28
npmextra.json Normal file
View File

@ -0,0 +1,28 @@
{
"npmci": {
"globalNpmTools": [],
"npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartlog-destination-local",
"description": "a smartlog destination targeting the local console",
"npmPackagename": "@push.rocks/smartlog-destination-local",
"license": "MIT",
"keywords": [
"logging",
"console log",
"log management",
"developer tools",
"local logging",
"console output"
]
}
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -1,4 +0,0 @@
{
"mode":"default",
"coveralls":true
}

View File

@ -1,50 +1,59 @@
{
"name": "beautylog",
"version": "6.1.1",
"description": "beautiful logging, TypeScript ready",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"name": "@push.rocks/smartlog-destination-local",
"private": false,
"version": "9.0.2",
"description": "a smartlog destination targeting the local console",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"scripts": {
"test": "(npmts)",
"testbrowser": "(npm test) && (node testbrowser.js)",
"gitsetup": "(git config push.followTags true)",
"push": "(git push origin master && git push origin release && git push --follow-tags)",
"reinstall": "(rm -r node_modules && npm install)",
"release": "(npm test) && (git pull origin master && npm version patch && git checkout release && git merge master && git checkout master && npm run push)",
"update": "(git checkout master && git pull origin master) && (npm install)",
"upgrade": "(npm run update) && (ncu upgradeAll && npm install)"
"test": "(tstest test/)",
"build": "(tsbuild --web)",
"buildDocs": "tsdoc"
},
"repository": {
"type": "git",
"url": "https://gitlab.com/pushrocks/beautylog.git"
"url": "https://code.foss.global/push.rocks/smartlog-destination-local.git"
},
"keywords": [
"log",
"color",
"console",
"beautiful"
"logging",
"console log",
"log management",
"developer tools",
"local logging",
"console output"
],
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
"author": "Lossless GmbH <hello@lossless.com> (https://lossless.com)",
"license": "MIT",
"bugs": {
"url": "https://gitlab.com/pushrocks/beautylog/issues"
},
"homepage": "https://gitlab.com/pushrocks/beautylog",
"homepage": "https://code.foss.global/push.rocks/smartlog-destination-local",
"dependencies": {
"@types/lodash": "4.x.x",
"beautycolor": "^1.0.5",
"figlet": "^1.2.0",
"lodash": "^4.17.4",
"ora": "^1.1.0",
"smartenv": "^2.0.0",
"smartq": "^1.0.4",
"typings-global": "^1.0.14"
"@push.rocks/consolecolor": "^2.0.1",
"@push.rocks/smartlog-interfaces": "^3.0.0",
"@push.rocks/smartpromise": "^4.0.2"
},
"devDependencies": {
"beautyremote": "^1.0.2",
"npmts-g": "^6.0.0",
"qenv": "^1.1.3",
"smartchai": "^1.0.1",
"typings-test": "^1.0.3"
}
}
"@git.zone/tsbuild": "^2.1.66",
"@git.zone/tsrun": "^1.2.42",
"@git.zone/tstest": "^1.0.74",
"@push.rocks/tapbundle": "^5.0.8",
"@types/node": "^20.4.1"
},
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"type": "module",
"browserslist": [
"last 1 chrome versions"
]
}

5009
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +0,0 @@
vars:
- LOGGLY_TOKEN

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

111
readme.md Normal file
View File

@ -0,0 +1,111 @@
# @push.rocks/smartlog-destination-local
a smartlog destination targeting the local console
## Install
To use `@push.rocks/smartlog-destination-local` in your project, you need to install it via npm. You can do this by running:
```bash
npm install @push.rocks/smartlog-destination-local --save
```
This command adds `@push.rocks/smartlog-destination-local` to your project's dependencies and enables you to start implementing its features in your application.
## Usage
The `@push.rocks/smartlog-destination-local` package provides a way to easily log messages to the local console with support for color coding and structured message formats. It is especially useful when combined with the `@push.rocks/smartlog` package to create a powerful logging solution that is both visually informative and structured for better logging practices.
### Importing and Setting Up
First, make sure to import the package where you intend to use it:
```typescript
import { DestinationLocal } from '@push.rocks/smartlog-destination-local';
```
Next, create an instance of `DestinationLocal`:
```typescript
const localLogDestination = new DestinationLocal();
```
### Logging Messages
The primary feature of `@push.rocks/smartlog-destination-local` is to log messages to the console. This can be done by preparing a log package and using the `handleLog` method.
#### Example Log Message
```typescript
import type { ILogPackage } from '@push.rocks/smartlog-interfaces';
const logPackage: ILogPackage = {
timestamp: Date.now(),
type: 'log', // or 'error', 'warn', etc. depending on the nature of the message
level: 'info', // determines the visibility and importance of the log
context: {
company: 'Your Company',
companyunit: 'Your Unit',
containerName: 'Your Container',
environment: 'development',
runtime: 'node',
zone: 'Your Zone'
},
message: 'This is a test log message.', // the actual message
correlation: {
id: 'uniqueId', // useful for tracing logs
type: 'requestId'
},
};
// Using the instance to log the message
localLogDestination.handleLog(logPackage);
```
This will output a structured, color-coded log message to your console, making it easier to differentiate between various log levels and to understand the context of the log messages at a glance.
### Log Reduction
For scenarios where repeated log messages may clutter your log output, `@push.rocks/smartlog-destination-local` offers a `logReduced` method. This method will throttle the output of identical consecutive messages according to the settings you provide.
#### Reducing Log Output
```typescript
// Log a message repeatedly, e.g., in a loop
for (let i = 0; i < 100; i++) {
localLogDestination.logReduced('Repeated message', 5); // only logs every 5th identical message
}
```
### Adding New Lines
You may want to improve the readability of your logs by inserting blank lines. This can be easily achieved:
```typescript
localLogDestination.newLine(2); // Inserts two empty lines in the log output
```
### Advanced Use Cases
The `@push.rocks/smartlog-destination-local` package is flexible and integrates seamlessly with other logging and monitoring solutions. It can be extended or customized to fit more complex logging requirements, such as filtering logs based on environment, enhancing log messages with additional metadata, or integrating with remote logging services for centralized log management.
### Conclusion
`@push.rocks/smartlog-destination-local` serves as a robust, easy-to-use solution for enhancing your application's logging capabilities. By following the examples and using the provided methods, you can quickly implement effective logging practices that improve debugging, monitoring, and analysis of your application's behavior in development and production environments.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
<head>
<script async src="browserified/index.js"></script>
</head>
<body>
</body>

View File

@ -1,4 +0,0 @@
var beautylog = require("./index.js");
console.log("*** start browser console test (Might look weird in OS console and travis log...) ***");
beautylog.log("hello");
console.log("*** end browser console test ***");

1
test/test.d.ts vendored
View File

@ -1 +0,0 @@
import 'typings-test';

View File

@ -1,104 +0,0 @@
"use strict";
require("typings-test");
const beautylog = require("../dist/index");
const beautyremote = require("beautyremote");
const qenv = require("qenv");
let testQenv = new qenv.Qenv(process.cwd(), process.cwd() + '/.nogit');
describe('beautylog', function () {
describe('.registerRemote', function () {
it('should accept a beautyremote', function () {
let myRemote = new beautyremote.Loggly({
token: process.env.LOGGLY_TOKEN
});
beautylog.registerRemote(myRemote);
});
});
describe('.log(message)', function () {
it('should print a blue Dir message', function () {
beautylog.log('beautylog.log(), with normal logText, without logType');
});
});
describe('.dir(message)', function () {
it('should print a blue Dir message', function () {
beautylog.dir('beautylog.dir(), with normal logText, without logType');
});
});
describe('.error(message)', function () {
it('should print a red error message', function () {
beautylog.error('beautylog.error(), with normal logText, without logType');
});
});
describe('.figlet', function () {
it('should print nice fonts to console in yellow', function (done) {
beautylog.figlet('Async!', { font: 'Star Wars', color: 'orange' }).then(done);
});
});
describe('.figletSync', function () {
it('should print nice fonts to console in yellow', function () {
beautylog.figletSync('Sync!', { font: 'Star Wars', color: 'blue' });
});
});
describe('.info(message)', function () {
it('should display a purple info message', function () {
beautylog.info('beautylog.dir(), with normal logText, without logType');
});
});
describe('.logReduced(message)', function () {
it('should only log two messages', function () {
beautylog.logReduced('Message 1');
beautylog.logReduced('Message 1');
beautylog.logReduced('Message 1');
beautylog.logReduced('Message 1');
beautylog.logReduced('Message 2');
beautylog.logReduced('Message 2');
});
});
describe('.ok(message)', function () {
it('should display a green ok message', function () {
beautylog.ok('beautylog.ok() works!');
});
});
describe('.newLine(number)', function () {
it('create specified amount of new lines', function () {
beautylog.newLine(1);
});
});
describe('.ora(text,color)', function () {
it('should display, update, and end a message', function (done) {
this.timeout(10000);
beautylog.ora.start('This is a test text', 'green');
setTimeout(function () {
beautylog.ora.text('updated text!');
beautylog.info('another log message that uses the normal log function');
setTimeout(function () {
beautylog.ora.endOk('Allright, ora works!');
done();
}, 2000);
}, 2000);
});
it('should display an error message when ended with error', function (done) {
this.timeout(10000);
beautylog.ora.start('This is another test text', 'green');
setTimeout(function () {
beautylog.ora.endError('Allright, ora displays an error!');
done();
}, 2000);
});
});
describe('.success(message)', function () {
it('should display an orange warn message', function () {
beautylog.success('beautylog.success() works!');
});
});
describe('.warn', function () {
it('should display a orange warn message', function () {
beautylog.warn('beautylog.warn() works!');
});
});
describe('.note', function () {
it('should display a pink note', function () {
beautylog.note('beautylog.note() works!');
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQiwyQ0FBMkM7QUFDM0MsNkNBQTRDO0FBRTVDLDZCQUE0QjtBQUM1QixJQUFJLFFBQVEsR0FBRyxJQUFJLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxFQUFFLE9BQU8sQ0FBQyxHQUFHLEVBQUUsR0FBRyxTQUFTLENBQUMsQ0FBQTtBQUV0RSxRQUFRLENBQUM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BSSxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQTtZQUNuQixTQUFTLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQywyQkFBMkIsRUFBQyxPQUFPLENBQUMsQ0FBQTtZQUN4RCxVQUFVLENBQUM7Z0JBQ1AsU0FBUyxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsa0NBQWtDLENBQUMsQ0FBQTtnQkFDMUQsSUFBSSxFQUFFLENBQUE7WUFDVixDQUFDLEVBQUMsSUFBSSxDQUFDLENBQUE7UUFDWCxDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0lBQ0YsUUFBUSxDQUFDLG1CQUFtQixFQUFDO1FBQ3pCLEVBQUUsQ0FBQyx1Q0FBdUMsRUFBQztZQUN2QyxTQUFTLENBQUMsT0FBTyxDQUFDLDRCQUE0QixDQUFDLENBQUE7UUFDbkQsQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDLENBQUMsQ0FBQTtJQUNGLFFBQVEsQ0FBQyxPQUFPLEVBQUM7UUFDYixFQUFFLENBQUMsc0NBQXNDLEVBQUM7WUFDdEMsU0FBUyxDQUFDLElBQUksQ0FBQyx5QkFBeUIsQ0FBQyxDQUFBO1FBQzdDLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUE7SUFDRixRQUFRLENBQUMsT0FBTyxFQUFFO1FBQ2QsRUFBRSxDQUFDLDRCQUE0QixFQUFFO1lBQzdCLFNBQVMsQ0FBQyxJQUFJLENBQUMseUJBQXlCLENBQUMsQ0FBQTtRQUM3QyxDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==

View File

@ -1,104 +1,49 @@
import 'typings-test'
import beautylog = require('../dist/index')
import * as beautyremote from 'beautyremote'
import { tap, expect } from '@push.rocks/tapbundle';
import * as qenv from 'qenv'
let testQenv = new qenv.Qenv(process.cwd(), process.cwd() + '/.nogit')
import * as smartlogDesinationLocal from '../ts/index.js';
import type { ILogContext } from '@push.rocks/smartlog-interfaces';
describe('beautylog',function(){
describe('.registerRemote', function() {
it('should accept a beautyremote', function(){
let myRemote = new beautyremote.Loggly({
token: process.env.LOGGLY_TOKEN
})
beautylog.registerRemote(myRemote)
})
})
describe('.log(message)',function(){
it('should print a blue Dir message',function(){
beautylog.log('beautylog.log(), with normal logText, without logType')
})
})
describe('.dir(message)',function(){
it('should print a blue Dir message',function(){
beautylog.dir('beautylog.dir(), with normal logText, without logType')
})
})
describe('.error(message)',function(){
it('should print a red error message',function(){
beautylog.error('beautylog.error(), with normal logText, without logType')
})
})
describe('.figlet',function(){
it('should print nice fonts to console in yellow',function(done){
beautylog.figlet('Async!',{font: 'Star Wars',color: 'orange'}).then(done)
})
})
describe('.figletSync',function(){
it('should print nice fonts to console in yellow',function(){
beautylog.figletSync('Sync!',{font: 'Star Wars',color: 'blue'})
})
})
describe('.info(message)',function(){
it('should display a purple info message',function(){
beautylog.info('beautylog.dir(), with normal logText, without logType')
})
})
describe('.logReduced(message)',function(){
it('should only log two messages',function(){
beautylog.logReduced('Message 1')
beautylog.logReduced('Message 1')
beautylog.logReduced('Message 1')
beautylog.logReduced('Message 1')
beautylog.logReduced('Message 2')
beautylog.logReduced('Message 2')
})
})
describe('.ok(message)',function(){
it('should display a green ok message',function(){
beautylog.ok('beautylog.ok() works!')
})
})
describe('.newLine(number)',function(){
it('create specified amount of new lines',function(){
beautylog.newLine(1)
})
})
describe('.ora(text,color)',function(){
it('should display, update, and end a message',function(done){
this.timeout(10000)
beautylog.ora.start('This is a test text','green')
setTimeout(function(){
beautylog.ora.text('updated text!')
beautylog.info('another log message that uses the normal log function')
setTimeout(function(){
beautylog.ora.endOk('Allright, ora works!')
done()
},2000)
},2000)
})
it('should display an error message when ended with error',function(done){
this.timeout(10000)
beautylog.ora.start('This is another test text','green')
setTimeout(function(){
beautylog.ora.endError('Allright, ora displays an error!')
done()
},2000)
})
})
describe('.success(message)',function(){
it('should display an orange warn message',function(){
beautylog.success('beautylog.success() works!')
})
})
describe('.warn',function(){
it('should display a orange warn message',function(){
beautylog.warn('beautylog.warn() works!')
})
})
describe('.note', function() {
it('should display a pink note', function() {
beautylog.note('beautylog.note() works!')
})
})
})
const testLogContext: ILogContext = {
company: 'Lossless GmbH',
companyunit: 'Lossless.Cloud',
containerName: 'gitlabci',
environment: 'staging',
runtime: 'node',
zone: 'shipzone',
};
let testLocalInstance: smartlogDesinationLocal.DestinationLocal;
tap.test('should create a valid instance of DestinationLocal', async () => {
testLocalInstance = new smartlogDesinationLocal.DestinationLocal();
expect(testLocalInstance).toBeInstanceOf(smartlogDesinationLocal.DestinationLocal);
});
tap.test('.log(message) should print a blue Dir message', async () => {
testLocalInstance.handleLog({
timestamp: Date.now(),
type: 'log',
level: 'info',
context: testLogContext,
message: 'this is a info log message',
correlation: {
id: '123',
type: 'none',
},
});
});
tap.test('.logReduced(message) should only log two messages', async () => {
testLocalInstance.logReduced('Message 1');
testLocalInstance.logReduced('Message 1');
testLocalInstance.logReduced('Message 1');
testLocalInstance.logReduced('Message 1');
testLocalInstance.logReduced('Message 2');
testLocalInstance.logReduced('Message 2');
});
tap.test('.newLine(number) create specified amount of new lines', async () => {
testLocalInstance.newLine(1);
});
tap.start();

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartlog-destination-local',
version: '9.0.2',
description: 'a smartlog destination targeting the local console'
}

View File

@ -1,54 +0,0 @@
import 'typings-global'
import * as plugins from './beautylog.plugins'
import {logNode} from './beautylog.log.helpers'
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 {
state: string
private _oraObject
constructor(textArg: string,colorArg: string,startArg: boolean = false) {
this._oraObject = plugins.ora({
spinner: 'dots',
text: textArg,
color: colorArg
})
if (startArg) {
this.start()
}
}
text(textArg) {
this._oraObject.text = textArg
}
start(textArg?: string,colorArg?: string) {
if (textArg) { this.text(textArg) }
if (colorArg) { this._oraObject.color = colorArg }
activeOra = this
oraActive = true
this._oraObject.start()
}
end() {
this._oraObject.stop()
this._oraObject.clear()
activeOra = undefined
oraActive = false
}
endOk(textArg) {
this.end()
logNode('ok',textArg)
}
endError(textArg) {
this.end()
logNode('error',textArg)
}
pause() {
this._oraObject.stop()
}
stop() { // alias for end
this.end()
}
}
export let ora = new Ora('init...', 'blue', false)

View File

@ -1,40 +0,0 @@
import 'typings-global'
import plugins = require('./beautylog.plugins')
import { activeOra, oraActive } from './beautylog.classes.ora'
let nativeLog = console.log
let nativeError = console.error
/**
* routes the console to got through beautylog, so beautylog can take action before things are logged to console.
*/
let route = function(statusArg: boolean){
if (statusArg === true) {
console.log = beautyConsole.log
console.error = beautyConsole.error
} else {
console.log = nativeLog
}
}
export let beautyConsole = {
log: function(logArg: any) {
if (oraActive) {
activeOra.pause()
nativeLog.apply(nativeLog, arguments)
activeOra.start()
} else {
nativeLog.apply(nativeLog, arguments)
}
},
error: function(){
if (oraActive) {
activeOra.pause()
nativeLog.apply(nativeError, arguments)
activeOra.start()
} else {
nativeLog.apply(nativeError, arguments)
}
}
}
route(true)

View File

@ -1,61 +0,0 @@
import 'typings-global'
import plugins = require('./beautylog.plugins')
export interface IFigletOptions {
font?: string
color?: plugins.beautycolor.TColorName
cb?
}
let defaultOptions: IFigletOptions = {
font: 'Star Wars',
color: 'green',
cb: function() {}
}
export let figlet = function(textArg: string, optionsArg?){
let done = plugins.q.defer()
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions)
let options = plugins.lodash.assign(mergeOptions,optionsArg)
plugins.figlet(
textArg,
{
font: options.font,
horizontalLayout: 'default',
verticalLayout: 'default'
},
function(err, data: string) {
if (err) {
console.log('Something went wrong...')
console.dir(err)
return
}
console.log(colorFiglet(data, options.color))
options.cb()
done.resolve()
}
)
return done.promise
}
export let figletSync = function(textArg: string,optionsArg?: IFigletOptions){
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions)
let options = plugins.lodash.assign(mergeOptions,optionsArg)
let figletString: string = plugins.figlet.textSync(textArg,{
font: options.font,
horizontalLayout: 'default',
verticalLayout: 'default'
})
console.log(colorFiglet(figletString, options.color))
return true
}
let colorFiglet = (figletStringArg, colorArg: plugins.beautycolor.TColorName) => {
let figletArray = figletStringArg.split('\n')
let figletStringCombined = ''
for (let figletRow of figletArray ) {
figletRow = plugins.beautycolor.coloredString(figletRow, colorArg)
figletStringCombined = figletStringCombined + figletRow + '\n'
}
return figletStringCombined
}

View File

@ -1,112 +0,0 @@
import * as plugins from './beautylog.plugins'
import { remoteLog } from './beautylog.remote'
/**
*
* @param logText
* @param logType
* @returns {boolean}
*/
export let internalLog = function (logType: string = 'normal', logText: string = 'empty log') {
switch (plugins.smartenv.getEnv().runtimeEnv) {
case 'node':
logNode(logType, logText)
remoteLog(logType, logText)
break
case 'browser':
logBrowser(logText, logType)
break
default:
console.log('something is strange about the platform in which you try to use beautylog')
break
}
}
let coloredString = plugins.beautycolor.coloredString
let localBl = {
dirPrefix: coloredString(' DIR ', 'white', 'blue') + ' ',
errorPrefix: coloredString(' ', 'red','red') + coloredString(' ERROR! ', 'red', 'black') + ' ',
infoPrefix: coloredString(' ', 'blue', 'blue') + coloredString(' INFO: ', 'blue', 'black') + ' ',
logPrefix: coloredString(' ', 'white', 'cyan') + coloredString(' LOG: ', 'cyan', 'black') + ' ',
notePrefix: coloredString(' ', 'pink', 'pink') + coloredString( ' NOTE -> ', 'pink', 'black') + ' ',
okPrefix: coloredString(' ', 'green', 'green') + coloredString(' OK! ', 'green', 'black') + ' ',
successPrefix: coloredString(' ', 'green', 'green') + coloredString(' SUCCESS! ', 'green', 'black') + ' ',
warnPrefix: coloredString(' ', 'orange', 'orange') + coloredString(' WARN: -> ', 'orange', 'black') + ' '
}
export let logNode = function (logType: string, logText: string) {
try {
switch (logType) {
case 'dir':
logText = localBl.dirPrefix + coloredString(logText, 'blue')
break
case 'error':
logText = localBl.errorPrefix + coloredString(logText, 'red')
break
case 'info':
logText = localBl.infoPrefix + coloredString(logText, 'blue')
break
case 'normal':
logText = localBl.logPrefix + coloredString(logText, 'cyan')
break
case 'note':
logText = localBl.notePrefix + coloredString(logText, 'pink')
break
case 'ok':
logText = localBl.okPrefix + coloredString(logText, 'green')
break
case 'success':
logText = localBl.successPrefix + coloredString(logText, 'green')
break
case 'warn':
logText = localBl.warnPrefix + coloredString(logText, 'orange')
break
case 'log':
logText = localBl.logPrefix + coloredString(logText, 'cyan')
break
default:
coloredString(logText, 'blue')
console.log(('unknown logType for "' + logText + '"'))
break
}
console.log(logText)
return true
} catch (error) {
console.log(localBl.errorPrefix
+ 'You seem to have tried logging something strange' + error)
return false
}
}
let logBrowser = function (logText, logType) {
switch (logType) {
case 'dir':
logText = localBl.dirPrefix + coloredString(logText, 'blue')
break
case 'error':
logText = localBl.errorPrefix + logText.red.bold
break
case 'info':
console.log('%c Info: %c ' + logText, 'background:#EC407A;color:#ffffff;', 'color:#EC407A;')
break
case 'normal':
logText = localBl.logPrefix + logText.cyan.bold
break
case 'ok':
console.log('%c OK: %c ' + logText, 'background:#000000;color:#8BC34A;', 'color:#000000;')
break
case 'success':
console.log('%c Success: %c ' + logText, 'background:#8BC34A;color:#ffffff;', 'color:#8BC34A;')
break
case 'warn':
console.log('%c Warn: %c ' + logText, 'background:#000000;color:#FB8C00;', 'color:#000000;')
break
case 'log':
console.log('%c Log: %c ' + logText, 'background:#42A5F5;color:#ffffff', 'color:#42A5F5;')
break
default:
console.log('unknown logType for "' + logText + '"')
break
}
}

View File

@ -1,95 +0,0 @@
import 'typings-global'
import {internalLog} from './beautylog.log.helpers'
/**
* logs an info to console
* @param logText
* @returns {boolean}
*/
export let log = (logText) => {
return internalLog('log',logText)
}
export let info = (logText) => {
return internalLog('info',logText)
}
/**
* logs an 'OK!' message to console
* @param logText
* @returns {boolean}
*/
export let ok = (logText) => {
return internalLog('ok',logText)
}
/**
* logs a success to console
* @param logText string to log as error
* @returns {boolean}
*/
export let success = (logText) => {
return internalLog('success',logText)
}
/**
* logs a 'warn:' message to console
* @param logText string to log as error
* @returns {boolean}
*/
export let warn = (logText) => {
return internalLog('warn',logText)
}
/**
* logs an error to console
* @param logText
* @returns {boolean}
*/
export let error = (logText) => {
return internalLog('error',logText)
}
/**
* logs an directory to console
* @param logText
* @returns {boolean}
*/
export let dir = (logText) => {
return internalLog('dir',logText)
}
/**
* note
*/
export let note = (logText) => {
return internalLog('note', logText)
}
/**
* creates a new empty line
* @param linesArg
* @returns void
*/
export let newLine = (linesArg: number = 1) => {
for (let i = 0; i < linesArg; i++) {
console.log('\n')
}
}
/**
* logs a reduced log that only logs changes of consequential log messages
*/
export let logReduced = (logTextArg: string,repeatEveryTimesArg: number = 0) => {
if (logTextArg === previousMessage && (repeatEveryTimesArg === 0 || sameMessageCounter !== repeatEveryTimesArg)) {
sameMessageCounter++
} else {
sameMessageCounter = 0
previousMessage = logTextArg
log(logTextArg)
}
}
let previousMessage: string = ''
let sameMessageCounter: number = 0

View File

@ -1,17 +0,0 @@
import 'typings-global'
import * as beautycolor from 'beautycolor'
import * as lodash from 'lodash'
import * as smartenv from 'smartenv'
import * as q from 'smartq'
let figlet = require('figlet')
let ora = require('ora')
export {
beautycolor,
lodash,
smartenv,
q,
figlet,
ora
}

View File

@ -1,8 +0,0 @@
import {remoteArray} from './beautylog.remote'
/**
* registers a remote
*/
export let registerRemote = (remoteArg: any) => {
remoteArray.push(remoteArg)
}

View File

@ -1,17 +0,0 @@
import * as plugins from './beautylog.plugins'
export interface ILogMethod {
(logType: string, logMessage: string): void
}
export interface IBeautyRemote {
log: ILogMethod
}
export let remoteArray: IBeautyRemote[] = []
export let remoteLog = (logType: string, logMessage: string) => {
for (let beautyremote of remoteArray) {
beautyremote.log(logType, logMessage)
}
}

View File

@ -0,0 +1,135 @@
import * as plugins from './plugins.js';
import type { ILogDestination, ILogPackage, TLogLevel } from '@push.rocks/smartlog-interfaces';
// other beautylog classes
import { type TColorName } from '@push.rocks/consolecolor';
export class DestinationLocal implements ILogDestination {
/**
* handles a log according to the smartlog standard
* @param logPackage
*/
public async handleLog(logPackage: ILogPackage) {
this.logToConsole(logPackage);
}
/**
* creates a new empty line
* @param linesArg
* @returns void
*/
public newLine(linesArg: number = 1) {
for (let i = 0; i < linesArg; i++) {
console.log('\n');
}
}
/**
* logs a reduced log that only logs changes of consequential log messages
*/
public logReduced(logTextArg: string, repeatEveryTimesArg: number = 0) {
if (
logTextArg === this.previousMessage &&
(repeatEveryTimesArg === 0 || this.sameMessageCounter !== repeatEveryTimesArg)
) {
this.sameMessageCounter++;
} else {
this.sameMessageCounter = 0;
this.previousMessage = logTextArg;
this.logToConsole({
timestamp: Date.now(),
type: 'log',
level: 'info',
context: {
company: 'undefined',
companyunit: 'undefined',
containerName: 'undefined',
environment: 'test',
runtime: 'node',
zone: 'undefined',
},
message: logTextArg,
correlation: {
id: 'none',
type: 'none',
},
});
}
}
private previousMessage: string = '';
private sameMessageCounter: number = 0;
// default logging
private logToConsole(logPackageArg: ILogPackage) {
let logString: string;
try {
logString =
this.localBl[logPackageArg.level].prefix +
plugins.consolecolor.coloredString(
logPackageArg.message,
this.localBl[logPackageArg.level].textColor
);
console.log(logString);
return true;
} catch (error) {
console.log(
this.localBl.errorPrefix + 'You seem to have tried logging something strange' + error
);
return false;
}
}
private localBl: {
[key: string]: {
prefix: string;
textColor: TColorName;
};
} = {
silly: {
prefix: plugins.consolecolor.coloredString(' silly ', 'white', 'blue') + ' ',
textColor: 'blue',
},
error: {
prefix:
plugins.consolecolor.coloredString(' ', 'red', 'red') +
plugins.consolecolor.coloredString(' ERROR! ', 'red', 'black') +
' ',
textColor: 'red',
},
info: {
prefix:
plugins.consolecolor.coloredString(' ', 'blue', 'blue') +
plugins.consolecolor.coloredString(' info: ', 'blue', 'black') +
' ',
textColor: 'white',
},
note: {
prefix:
plugins.consolecolor.coloredString(' ', 'pink', 'pink') +
plugins.consolecolor.coloredString(' note -> ', 'pink', 'black') +
' ',
textColor: 'pink',
},
ok: {
prefix:
plugins.consolecolor.coloredString(' ', 'green', 'green') +
plugins.consolecolor.coloredString(' ok ', 'green', 'black') +
' ',
textColor: 'green',
},
success: {
prefix:
plugins.consolecolor.coloredString(' ', 'green', 'green') +
plugins.consolecolor.coloredString(' SUCCESS! ', 'green', 'black') +
' ',
textColor: 'green',
},
warn: {
prefix:
plugins.consolecolor.coloredString(' ', 'orange', 'orange') +
plugins.consolecolor.coloredString(' WARN -> ', 'orange', 'black') +
' ',
textColor: 'orange',
},
};
}

View File

@ -1,11 +1,2 @@
import 'typings-global'
import './beautylog.console'
import * as plugins from './beautylog.plugins'
// export classes
export { ora } from './beautylog.classes.ora'
// export methods
export { dir, error, info, log, logReduced, note, ok, success, warn, newLine } from './beautylog.log'
export { figlet, figletSync } from './beautylog.figlet'
export { registerRemote } from './beautylog.register'
export { DestinationLocal } from './classes.destinationlocal.js';

5
ts/plugins.ts Normal file
View File

@ -0,0 +1,5 @@
import * as consolecolor from '@push.rocks/consolecolor';
import * as smartlogInterfaces from '@push.rocks/smartlog-interfaces';
import * as smartpromise from '@push.rocks/smartpromise';
export { consolecolor, smartlogInterfaces, smartpromise };

14
tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
}

View File

@ -1,3 +0,0 @@
{
"extends": "tslint-config-standard"
}