Compare commits

..

No commits in common. "master" and "v4.1.3" have entirely different histories.

53 changed files with 26337 additions and 5667 deletions

1
.bithoundrc Normal file
View File

@ -0,0 +1 @@
{}

25
.gitignore vendored
View File

@ -1,20 +1,13 @@
.nogit/
# artifacts
coverage/
public/
pages/
# installs
node_modules/ node_modules/
.settings/
.idea/
coverage/
docs/
# caches #npm devug
.yarn/ npm-debug.log
.cache/
.rpt2_cache
# builds ts/*.js
dist/ ts/*.js.map
dist_*/ ts/typings/
# custom

View File

@ -1,128 +0,0 @@
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- security
- test
- release
- metadata
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 node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testBuild:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- 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:
stage: metadata
script:
- 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
allow_failure: true

View File

@ -1,11 +1,7 @@
test/
ts/
ts/typings/
.idea/
node_modules/ node_modules/
coverage/ coverage/
pages/ docs/
public/
ts/
docs/
.nogit/

15
.travis.yml Normal file
View File

@ -0,0 +1,15 @@
language: node_js
node_js:
- "4.3.1"
- "stable"
deploy:
provider: npm
email: npm@lossless.digital
api_key:
secure: NFZBWxf3BEuTu7eEQNqLtn7QD4pUJYovHVPL9x9iSx8wNCRL5keSPRx8vlmVTx4ddk5KmIERlw3i7ZLrF72msaiuU34kBh6edOpeswfBE0zR/WbV4ZU/LdxaP4bevYsl+gJnt5A4jHHFO6mqFp/R5vnqVkX3sAsPNr6cEVo8b3uNHHVxqs/gsoU/XBrNmQxPVbK1E/sVabZ/9blujxxTzGoyXbC2dIaD5sJ6z/mSagw1sCwrOdM7o0UDzsm81AtnFGegAmkd5Ps0dlcVdulKEcQkkfd9D3iq4SQ3efQVTSqD559bazxADf5VicoaEPAv8OVe8vKtc76KCiZfR5463Jl3LUoAt7UsX73aEsIg1cTsxkJCsGoiUqUQEucYKt8UcoicXJp2IUXRVkOxeXRRapERJgVKSSI965J5VqF3ZKWMnxfjrLde++wdrJ9L7EaTJbwDJohV4jqo794lv1yL+wWGO18NETQ01eV9LRDYCH/NOmWY7AZDNj2I1Ou2YImqxrFJfi1up4lOa+A4bcs6NSh3p/if4xBdOa5ALAWqQ7iUk1FReMPsLXZNLIgtUPbal+yR37DWDZ6imiYfJ5IMRV01yPGP6sBLnveTGR6DH1SxiycmIc0NOqFXjmgjtopCwRrpCUb1GBxMSNunvKyxrPJ+7Sxvbupcek3/tHf+z5g=
on:
tags: true
repo: pushrocks/beautylog
notifications:
slack:
secure: VBAcnFNkROLEa0vrp0qu8rBC8OlOvxpnYwqv3NMIbLie3Cq1YS03DwhqX0YV1hEBiGqh5cBe3s3PxtY8LHF5QjB4/82nQJSUHdcUxPTLh9Eq6IZaKCnSEFhMKPbZw0TwULIlbLv1RV/te1+G+fVKguCn4+f5TqTRxntYErVQu/0ovDa9ln3vtlqhDg9lYk3FBFqOszbHL81Xr2KpDj2DN/15nRmxEGGpnhzQV44HZg/W93EaUqTyF+NCtStPCbpOKno0s89rYRXMosuP+1odpNcSouVqWscEZSNCIg1NTTLY0N8T51pX1g8Lw9Qz80OMRnn8D83mVvNNqLJx5vQ8THz96/L77Syih6a5Qr0AyE7hGcbNrfG+3LvomHDARQ9Tv2KqDcrkiTdh7NtXYiQogxdWYx9OzTUOau4z8K5tr9lLlqFa6WYkFFaoc/+49IFAkgoUXg65gTYUMkP76xu/MC0XEOTU2+jvXLyyTpacD7nWRcbrI8XG7oCvT3BUc/boe4DSIqCwgaffqDVxld+dnVju2xKHedRC/OwhKXMnrBqFSlF2OTn67yFjxeq5DKxzyfwBKv9ia9FPqADSPTqaRJuE4eydM6u4cTdU1+8yQJNaPk0NRMmhksH2vscwaAdxX3kyUxi7DrS8qxpg1FZCA34YSmXyk88Ov8ZNPBL82xI=

11
.vscode/launch.json vendored
View File

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

26
.vscode/settings.json vendored
View File

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

63
README.md Normal file
View File

@ -0,0 +1,63 @@
# beautylog
beautiful logging
## Status
[![Build Status](https://travis-ci.org/pushrocks/beautylog.svg?branch=v0.0.9)](https://travis-ci.org/pushrocks/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 Score](https://www.bithound.io/github/pushrocks/beautylog/badges/score.svg)](https://www.bithound.io/github/pushrocks/beautylog)
[![Coverage Status](https://coveralls.io/repos/github/pushrocks/beautylog/badge.svg?branch=greenkeeper-npmts-2.1.10)](https://coveralls.io/github/pushrocks/beautylog?branch=greenkeeper-npmts-2.1.10)
## Usage
```javascript
### Simple Logging
var bl = require('beautylog'); //for use in OS console environment AND browser console
bl.log('some log message'); //normal console log message
bl.success('some success message'); //success console log message
bl.error('some error message'); //error console log message
//alternatively you can use a logType parameter
bl.log('some log message','normal');
bl.log('some success message','success');
bl.log('some error message','error');
```
The plugin produces beautiful output like this:
![console.png](https://mediaserve.lossless.digital/github.com/pushrocks/beautylog/console.png)
### Code Highlighting
### Console Tables
beautylog allows displaying data in nice tables for better overview.
There are different types of tables.
#### Custom
```javascript
var bl = require('beautylog')("os"); //for use in OS console environment
var myTable = bl.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
```
#### Checks
```javascript
var bl = require('beautylog')("os"); //for use in OS console environment
var myTable = bl.table.new("checks"); // type checks
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
```
The table from the code with type "checks" above looks like this:
![table.png](https://mediaserve.lossless.digital/github.com/pushrocks/beautylog/table.png)

120
code.css Normal file
View File

@ -0,0 +1,120 @@
.hljs {
display: block;
padding: 0.5em;
color: #333;
background: #f8f8f8;
}
.hljs-comment,
.hljs-template_comment,
.diff .hljs-header,
.hljs-javadoc {
color: #998;
font-style: italic;
}
.hljs-keyword,
.css .rule .hljs-keyword,
.hljs-winutils,
.javascript .hljs-title,
.nginx .hljs-title,
.hljs-subst,
.hljs-request,
.hljs-status {
color: #333;
font-weight: bold;
}
.hljs-number,
.hljs-hexcolor,
.ruby .hljs-constant {
color: #099;
}
.hljs-string,
.hljs-tag .hljs-value,
.hljs-phpdoc,
.tex .hljs-formula {
color: #d14;
}
.hljs-title,
.hljs-id,
.coffeescript .hljs-params,
.scss .hljs-preprocessor {
color: #900;
font-weight: bold;
}
.javascript .hljs-title,
.lisp .hljs-title,
.clojure .hljs-title,
.hljs-subst {
font-weight: normal;
}
.hljs-class .hljs-title,
.haskell .hljs-type,
.vhdl .hljs-literal,
.tex .hljs-command {
color: #458;
font-weight: bold;
}
.hljs-tag,
.hljs-tag .hljs-title,
.hljs-rules .hljs-property,
.django .hljs-tag .hljs-keyword {
color: #000080;
font-weight: normal;
}
.hljs-attribute,
.hljs-variable,
.lisp .hljs-body {
color: #008080;
}
.hljs-regexp {
color: #009926;
}
.hljs-symbol,
.ruby .hljs-symbol .hljs-string,
.lisp .hljs-keyword,
.tex .hljs-special,
.hljs-prompt {
color: #990073;
}
.hljs-built_in,
.lisp .hljs-title,
.clojure .hljs-built_in {
color: #0086b3;
}
.hljs-preprocessor,
.hljs-pragma,
.hljs-pi,
.hljs-doctype,
.hljs-shebang,
.hljs-cdata {
color: #999;
font-weight: bold;
}
.hljs-deletion {
background: #fdd;
}
.hljs-addition {
background: #dfd;
}
.diff .hljs-change {
background: #0086b3;
}
.hljs-chunk {
color: #aaa;
}

8
dist/beautylog.classes.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
export declare class ConsoleTable {
tableHead: string[];
rows: any;
type: string;
constructor(tableTypeArg: string, tableHeadArrayArg?: string[]);
push(row: string[]): void;
print(): void;
}

54
dist/beautylog.classes.js vendored Normal file
View File

@ -0,0 +1,54 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
var plugins = require("./beautylog.plugins");
var tableHelpers = {
makeRow: function (cellCounterArg, colorArg) {
if (cellCounterArg === void 0) { cellCounterArg = 2; }
if (colorArg === void 0) { colorArg = "cyan"; }
var rowArray = [];
for (var i = 0; i < (cellCounterArg); i++) {
rowArray.push(String(i + 1).cyan);
}
return rowArray;
}
};
var ConsoleTable = (function () {
function ConsoleTable(tableTypeArg, tableHeadArrayArg) {
if (tableHeadArrayArg === void 0) { tableHeadArrayArg = tableHelpers.makeRow(); }
switch (tableTypeArg) {
case "checks":
this.tableHead = ['Check Item:'.cyan, 'Status:'.cyan];
break;
case "custom":
this.tableHead = tableHeadArrayArg;
break;
default:
break;
}
this.rows = [];
this.type = tableTypeArg;
}
ConsoleTable.prototype.push = function (row) {
this.rows.push(row);
};
ConsoleTable.prototype.print = function () {
var table = new plugins.cliTable({
head: this.tableHead
});
for (var row in this.rows) {
if (this.rows[row][1] == "success") {
this.rows[row][1] = ' '.bgGreen + ' ' + this.rows[row][1];
}
else if (this.rows[row][1] == "error") {
this.rows[row][1] = ' '.bgRed + ' ' + this.rows[row][1];
}
table.push(this.rows[row]);
}
;
console.log(table.toString());
};
return ConsoleTable;
}());
exports.ConsoleTable = ConsoleTable;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5jbGFzc2VzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0Q0FBNEM7QUFDNUMsSUFBTyxPQUFPLFdBQVcscUJBQXFCLENBQUMsQ0FBQztBQUVoRCxJQUFJLFlBQVksR0FBRztJQUNmLE9BQU8sRUFBRSxVQUFTLGNBQXlCLE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VjayBJdGVtOicuY3lhbiwnU3RhdHVzOicuY3lhbl07XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwiY3VzdG9tXCI6XG4gICAgICAgICAgICAgICAgdGhpcy50YWJsZUhlYWQgPSB0YWJsZUhlYWRBcnJheUFyZztcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5yb3dzID0gW107XG4gICAgICAgIHRoaXMudHlwZSA9IHRhYmxlVHlwZUFyZztcbiAgICB9XG4gICAgcHVzaChyb3c6c3RyaW5nW10pe1xuICAgICAgICB0aGlzLnJvd3MucHVzaChyb3cpO1xuICAgIH1cbiAgICBwcmludCgpIHtcbiAgICAgICAgdmFyIHRhYmxlID0gbmV3IHBsdWdpbnMuY2xpVGFibGUoe1xuICAgICAgICAgICAgaGVhZDogdGhpcy50YWJsZUhlYWRcbiAgICAgICAgfSk7XG4gICAgICAgIGZvciAodmFyIHJvdyBpbiB0aGlzLnJvd3Mpe1xuICAgICAgICAgICAgaWYodGhpcy5yb3dzW3Jvd11bMV0gPT0gXCJzdWNjZXNzXCIpe1xuICAgICAgICAgICAgICAgIHRoaXMucm93c1tyb3ddWzFdID0gJyAnLmJnR3JlZW4gKyAnICcgKyB0aGlzLnJvd3Nbcm93XVsxXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodGhpcy5yb3dzW3Jvd11bMV0gPT0gXCJlcnJvclwiKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5yb3dzW3Jvd11bMV0gPSAnICcuYmdSZWQgKyAnICcgKyB0aGlzLnJvd3Nbcm93XVsxXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRhYmxlLnB1c2godGhpcy5yb3dzW3Jvd10pO1xuICAgICAgICB9O1xuICAgICAgICBjb25zb2xlLmxvZyh0YWJsZS50b1N0cmluZygpKTtcbiAgICB9XG59XG4iXX0=

2
dist/beautylog.figlet.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export declare var figlet: (textArg: string, optionsArg?: any) => any;
export declare var figletSync: (textArg: string, optionsArg?: any) => boolean;

40
dist/beautylog.figlet.js vendored Normal file
View File

@ -0,0 +1,40 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
var plugins = require("./beautylog.plugins");
var defaultOptions = {
font: "Star Wars",
color: "green",
cb: function () { }
};
exports.figlet = function (textArg, optionsArg) {
var done = plugins.q.defer();
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
var 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(data[options.color]);
options.cb();
done.resolve();
});
return done.promise;
};
exports.figletSync = function (textArg, optionsArg) {
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
var options = plugins.lodash.assign(mergeOptions, optionsArg);
console.log(plugins.figlet.textSync(textArg, {
font: options.font,
horizontalLayout: 'default',
verticalLayout: 'default'
})[options.color]);
return true;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5maWdsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUM1QyxJQUFPLE9BQU8sV0FBVyxxQkFBcUIsQ0FBQyxDQUFDO0FBQ2hELElBQUksY0FBYyxHQUFHO0lBQ2pCLElBQUksRUFBQyxXQUFXO0lBQ2hCLEtBQUssRUFBRSxPQUFPO0lBQ2QsRUFBRSxFQUFFLGNBQVcsQ0FBQztDQUNuQixDQUFDO0FBRVMsY0FBTSxHQUFHLFVBQVMsT0FBYyxFQUFDLFVBQVc7SUFDbkQsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0F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Q6IG9wdGlvbnMuZm9udCxcbiAgICAgICAgaG9yaXpvbnRhbExheW91dDogJ2RlZmF1bHQnLFxuICAgICAgICB2ZXJ0aWNhbExheW91dDogJ2RlZmF1bHQnXG4gICAgfSwgZnVuY3Rpb24oZXJyLCBkYXRhKSB7XG4gICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKCdTb21ldGhpbmcgd2VudCB3cm9uZy4uLicpO1xuICAgICAgICAgICAgY29uc29sZS5kaXIoZXJyKTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBjb25zb2xlLmxvZyhkYXRhW29wdGlvbnMuY29sb3JdKTtcbiAgICAgICAgb3B0aW9ucy5jYigpO1xuICAgICAgICBkb25lLnJlc29sdmUoKTtcbiAgICB9KTtcbiAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xufTtcblxuZXhwb3J0IHZhciBmaWdsZXRTeW5jID0gZnVuY3Rpb24odGV4dEFyZzpzdHJpbmcsb3B0aW9uc0FyZz8pe1xuICAgIHZhciBtZXJnZU9wdGlvbnMgPSBwbHVnaW5zLmxvZGFzaC5jbG9uZURlZXAoZGVmYXVsdE9wdGlvbnMpO1xuICAgIHZhciBvcHRpb25zID0gcGx1Z2lucy5sb2Rhc2guYXNzaWduKG1lcmdlT3B0aW9ucyxvcHRpb25zQXJnKTtcbiAgICBjb25zb2xlLmxvZyhwbHVnaW5zLmZpZ2xldC50ZXh0U3luYyh0ZXh0QXJnLHtcbiAgICAgICAgZm9udDogb3B0aW9ucy5mb250LFxuICAgICAgICBob3Jpem9udGFsTGF5b3V0OiAnZGVmYXVsdCcsXG4gICAgICAgIHZlcnRpY2FsTGF5b3V0OiAnZGVmYXVsdCdcbiAgICB9KVtvcHRpb25zLmNvbG9yXSk7XG4gICAgcmV0dXJuIHRydWU7XG59O1xuIl19

37
dist/beautylog.log.d.ts vendored Normal file
View File

@ -0,0 +1,37 @@
export { log } from "./beautylog.log.helpers";
/**
* logs an info to console
* @param logText
* @returns {boolean}
*/
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;

7
dist/beautylog.log.helpers.d.ts vendored Normal file
View File

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

106
dist/beautylog.log.helpers.js vendored Normal file

File diff suppressed because one or more lines are too long

55
dist/beautylog.log.js vendored Normal file
View File

@ -0,0 +1,55 @@
/// <reference path="./typings/main.d.ts" />
"use strict";
var beautylog_log_helpers_1 = require("./beautylog.log.helpers");
var beautylog_log_helpers_2 = require("./beautylog.log.helpers");
exports.log = beautylog_log_helpers_2.log;
/**
* logs an info to console
* @param logText
* @returns {boolean}
*/
exports.info = function (logText) {
return beautylog_log_helpers_1.log(logText, 'info');
};
/**
* logs an 'OK!' message to console
* @param logText
* @returns {boolean}
*/
exports.ok = function (logText) {
return beautylog_log_helpers_1.log(logText, 'ok');
};
/**
* logs a success to console
* @param logText string to log as error
* @returns {boolean}
*/
exports.success = function (logText) {
return beautylog_log_helpers_1.log(logText, 'success');
};
/**
* logs a 'warn:' message to console
* @param logText string to log as error
* @returns {boolean}
*/
exports.warn = function (logText) {
return beautylog_log_helpers_1.log(logText, 'warn');
};
/**
* logs an error to console
* @param logText
* @returns {boolean}
*/
exports.error = function (logText) {
return beautylog_log_helpers_1.log(logText, 'error');
};
/**
* logs an directory to console
* @param logText
* @returns {boolean}
*/
exports.dir = function (logText) {
return beautylog_log_helpers_1.log(logText, 'dir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8gbG9nIGFzIGVycm9yXG4gKiBAcmV0dXJucyB7Ym9vbGVhbn1cbiAqL1xuZXhwb3J0IGxldCB3YXJuID0gZnVuY3Rpb24gKGxvZ1RleHQpIHtcbiAgICByZXR1cm4gbG9nKGxvZ1RleHQsICd3YXJuJyk7XG59O1xuXG4vKipcbiAqIGxvZ3MgYW4gZXJyb3IgdG8gY29uc29sZVxuICogQHBhcmFtIGxvZ1RleHRcbiAqIEByZXR1cm5zIHtib29sZWFufVxuICovXG5leHBvcnQgbGV0IGVycm9yID0gZnVuY3Rpb24gKGxvZ1RleHQpIHtcbiAgICByZXR1cm4gbG9nKGxvZ1RleHQsICdlcnJvcicpO1xufTtcblxuLyoqXG4gKiBsb2dzIGFuIGRpcmVjdG9yeSB0byBjb25zb2xlXG4gKiBAcGFyYW0gbG9nVGV4dFxuICogQHJldHVybnMge2Jvb2xlYW59XG4gKi9cbmV4cG9ydCBsZXQgZGlyID0gZnVuY3Rpb24gKGxvZ1RleHQpIHtcbiAgICByZXR1cm4gbG9nKGxvZ1RleHQsICdkaXInKTtcbn07Il19

2
dist/beautylog.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare var plugins: any;
export = plugins;

18
dist/beautylog.plugins.js vendored Normal file
View File

@ -0,0 +1,18 @@
/// <reference path="./typings/main.d.ts" />
"use strict";
var plugins = {
lodash: require("lodash"),
smartenv: require("smartenv"),
q: require("q")
};
if (plugins.smartenv.getEnv().isNode) {
plugins = plugins.lodash.assign(plugins, {
cliTable: require("cli-table2"),
colors: require("colors"),
clc: require("cli-color"),
figlet: require("figlet")
});
}
module.exports = plugins;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0Qzs7QUFFNUMsSUFBSSxPQUFPLEdBQU87SUFDZCxNQUFNLEVBQUUsT0FB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XVpcmUoXCJjb2xvcnNcIiksXG4gICAgICAgIGNsYzogcmVxdWlyZShcImNsaS1jb2xvclwiKSxcbiAgICAgICAgZmlnbGV0OiByZXF1aXJlKFwiZmlnbGV0XCIpXG4gICAgfSk7XG59XG5leHBvcnQgPSBwbHVnaW5zOyJdfQ==

4
dist/beautylog.table.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import classes = require("./beautylog.classes");
export declare let table: {
new: (typeArg: string, tableHeadArrayArg?: any) => classes.ConsoleTable;
};

11
dist/beautylog.table.js vendored Normal file
View File

@ -0,0 +1,11 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
var classes = require("./beautylog.classes");
exports.table = {
new: function (typeArg, tableHeadArrayArg) {
var newConsoleTable = new classes.ConsoleTable(typeArg, tableHeadArrayArg);
return newConsoleTable;
}
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy50YWJsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNENBQTRDO0FBQzVDLElBQU8sT0FBTyxXQUFXLHFCQUFxQixDQUFDLENBQUM7QUFFckMsYUFBSyxHQUFHO0lBQ2YsR0FBRyxFQUFFLFVBQVMsT0FBYyxFQUFDLGlCQUFrQjtRQUMzQyxJQUFJLGVBQWUsR0FBRyxJQUFJLE9BQU8sQ0FBQyxZQUFZLENBQUMsT0FBTyxFQUFDLGlCQUFpQixDQUFDLENBQUM7UUFDMUUsTUFBTSxDQUFDLGVBQWUsQ0FBQztJQUMzQixDQUFDO0NBQ0osQ0FBQyIsImZpbGUiOiJiZWF1dHlsb2cudGFibGUuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XG5pbXBvcnQgY2xhc3NlcyA9IHJlcXVpcmUoXCIuL2JlYXV0eWxvZy5jbGFzc2VzXCIpO1xuXG5leHBvcnQgbGV0IHRhYmxlID0ge1xuICAgIG5ldzogZnVuY3Rpb24odHlwZUFyZzpzdHJpbmcsdGFibGVIZWFkQXJyYXlBcmc/KSB7XG4gICAgICAgIHZhciBuZXdDb25zb2xlVGFibGUgPSBuZXcgY2xhc3Nlcy5Db25zb2xlVGFibGUodHlwZUFyZyx0YWJsZUhlYWRBcnJheUFyZyk7XG4gICAgICAgIHJldHVybiBuZXdDb25zb2xlVGFibGU7XG4gICAgfVxufTsiXX0=

16
dist/index.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
import * as classes from "./beautylog.classes";
declare let beautylog: {
log: (logText?: string, logType?: string) => void;
info: (logText: any) => void;
ok: (logText: any) => void;
success: (logText: any) => void;
warn: (logText: any) => void;
error: (logText: any) => void;
dir: (logText: any) => void;
figlet: (textArg: string, optionsArg?: any) => any;
figletSync: (textArg: string, optionsArg?: any) => boolean;
table: {
new: (typeArg: string, tableHeadArrayArg?: any) => classes.ConsoleTable;
};
};
export = beautylog;

20
dist/index.js vendored Normal file
View File

@ -0,0 +1,20 @@
/// <reference path="./typings/main.d.ts" />
"use strict";
var BeautylogLog = require("./beautylog.log");
var BeautylogFiglet = require("./beautylog.figlet");
var BeautylogTable = require("./beautylog.table");
var beautylog = {
log: BeautylogLog.log,
info: BeautylogLog.info,
ok: BeautylogLog.ok,
success: BeautylogLog.success,
warn: BeautylogLog.warn,
error: BeautylogLog.error,
dir: BeautylogLog.dir,
figlet: BeautylogFiglet.figlet,
figletSync: BeautylogFiglet.figletSync,
table: BeautylogTable.table
};
module.exports = beautylog;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0Qzs7QUFJNUMsSUFBWSxZQUFZLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUNoRCxJQUFZLGVBQWUsV0FBTSxvQkFDakMsQ0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gICAgbG9nOiBCZWF1dHlsb2dMb2cubG9nLFxuICAgIGluZm86IEJlYXV0eWxvZ0xvZy5pbmZvLFxuICAgIG9rOiBCZWF1dHlsb2dMb2cub2ssXG4gICAgc3VjY2VzczogQmVhdXR5bG9nTG9nLnN1Y2Nlc3MsXG4gICAgd2FybjogQmVhdXR5bG9nTG9nLndhcm4sXG4gICAgZXJyb3I6IEJlYXV0eWxvZ0xvZy5lcnJvcixcbiAgICBkaXI6IEJlYXV0eWxvZ0xvZy5kaXIsXG4gICAgZmlnbGV0OiBCZWF1dHlsb2dGaWdsZXQuZmlnbGV0LFxuICAgIGZpZ2xldFN5bmM6IEJlYXV0eWxvZ0ZpZ2xldC5maWdsZXRTeW5jLFxuICAgIHRhYmxlOiBCZWF1dHlsb2dUYWJsZS50YWJsZVxufTtcblxuXG5cbi8qc3dpdGNoKHBsdWdpbnMuc21hcnRlbnYuZ2V0RW52KCkucnVudGltZUVudikge1xuICAgIGNhc2UgXCJub2RlXCI6XG4gICAgICAgIGJlYXV0eWxvZyA9IEJlYXV0eWxvZ05vZGU7XG4gICAgICAgIGJyZWFrO1xuICAgIGNhc2UgXCJicm93c2VyXCI6XG4gICAgICAgIGJlYXV0eWxvZyA9IEJlYXV0eWxvZ0Jyb3dzZXI7XG4gICAgICAgIGJyZWFrO1xuICAgIGRlZmF1bHQ6XG4gICAgICAgIGNvbnNvbGUubG9nKFwic29tZXRoaW5nIGlzIHN0cmFuZ2UgYWJvdXQgdGhlIHBsYXRmb3JtIGluIHdoaWNoIHlvdSB0cnkgdG8gdXNlIGJlYXV0eWxvZ1wiKTtcbiAgICAgICAgYnJlYWs7XG59Ki9cblxuZXhwb3J0ID0gYmVhdXR5bG9nO1xuIl19

View File

@ -1,74 +0,0 @@
# beautylog
beautiful logging, TypeScript ready
## Availabililty
[![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)
[![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
Use TypeScript for best in class instellisense.
```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
```
### 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.
```javascript
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.
```javascript
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 further information read the linked docs at the top of this README.
> 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,28 +0,0 @@
{
"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"
}
}

4
npmts.json Normal file
View File

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

View File

@ -1,59 +1,47 @@
{ {
"name": "@push.rocks/smartlog-destination-local", "name": "beautylog",
"private": false, "version": "4.1.3",
"version": "9.0.2", "description": "beautiful logging",
"description": "a smartlog destination targeting the local console", "main": "dist/index.js",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(npmts)",
"build": "(tsbuild --web)", "testbrowser": "(npm test) && (node testbrowser.js)",
"buildDocs": "tsdoc" "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)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://code.foss.global/push.rocks/smartlog-destination-local.git" "url": "https://github.com/pushrocks/beautylog.git"
}, },
"keywords": [ "keywords": [
"logging", "log",
"console log", "color",
"log management", "console",
"developer tools", "beautiful"
"local logging",
"console output"
], ],
"author": "Lossless GmbH <hello@lossless.com> (https://lossless.com)", "author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://gitlab.com/pushrocks/beautylog/issues" "url": "https://github.com/pushrocks/beautylog/issues"
}, },
"homepage": "https://code.foss.global/push.rocks/smartlog-destination-local", "homepage": "https://github.com/pushrocks/beautylog",
"dependencies": { "dependencies": {
"@push.rocks/consolecolor": "^2.0.1", "cli-color": "^1.1.0",
"@push.rocks/smartlog-interfaces": "^3.0.0", "cli-table2": "^0.2.0",
"@push.rocks/smartpromise": "^4.0.2" "colors": "1.1.2",
"figlet": "^1.1.2",
"lodash": "^4.11.1",
"q": "^1.4.1",
"smartenv": "^1.2.2"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.1.66", "easyserve": "^0.0.5",
"@git.zone/tsrun": "^1.2.42", "gulp": "^3.9.1",
"@git.zone/tstest": "^1.0.74", "gulp-browser": "^2.0.1",
"@push.rocks/tapbundle": "^5.0.8", "npmts": "^5.1.5"
"@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

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@

111
readme.md
View File

@ -1,111 +0,0 @@
# @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

6
test/browser/index.html Normal file
View File

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

4
test/browser/index.js Normal file
View File

@ -0,0 +1,4 @@
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 ***");

2
test/test.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare var smartenv: any;
declare var beautylog: any;

75
test/test.js Normal file

File diff suppressed because one or more lines are too long

1
test/test.js.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACnC,IAAI,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAE5C,QAAQ,CAAC,WAAW,EAAC;IACjB,QAAQ,CAAC,uBAAuB,EAAC;QAC7B,EAAE,CAAC,sBAAsB,EAAC;YACtB,SAAS,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,uDAAuD,EAAC;YACvD,SAAS,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;YACvE,SAAS,CAAC,GAAG,CAAC,0DAA0D,EAAC,KAAK,CAAC,CAAC;YAChF,SAAS,CAAC,GAAG,CAAC,4DAA4D,EAAC,OAAO,CAAC,CAAC;YACpF,SAAS,CAAC,GAAG,CAAC,2DAA2D,EAAC,MAAM,CAAC,CAAC;YAClF,SAAS,CAAC,GAAG,CAAC,yDAAyD,EAAC,IAAI,CAAC,CAAC;YAC9E,SAAS,CAAC,GAAG,CAAC,8DAA8D,EAAC,SAAS,CAAC,CAAC;Y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
var beautylog = require('../dist/index.js');
import * as smartlogDesinationLocal from '../ts/index.js'; describe("beautylog",function(){
import type { ILogContext } from '@push.rocks/smartlog-interfaces'; describe(".log(message,logtype)",function(){
it("should log cyan text",function(){
beautylog.log('beautylog.log(), with normal logText, without logType');
});
it("should print different log types dependent on logType",function(){
beautylog.log('beautylog.log(), with normal logText, without logType');
beautylog.log('beautylog.log(), with normal logText, with logType "dir"','dir');
beautylog.log('beautylog.log(), with normal logText, with logType "error"','error');
beautylog.log('beautylog.log(), with normal logText, with logType "info"','info');
beautylog.log('beautylog.log(), with normal logText, with logType "ok"','ok');
beautylog.log('beautylog.log(), with normal logText, with logType "success"','success');
beautylog.log('beautylog.log(), with normal logText, with logType "warn"','warn');
});
});
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(".info(message)",function(){
it("should display a purple info message",function(){
beautylog.info('beautylog.dir(), with normal logText, without logType');
});
});
describe(".ok(message)",function(){
it("should display a green ok message",function(){
beautylog.ok('beautylog.ok(), with normal logText, without logType');
});
});
describe(".success(message)",function(){
it("should display an orange warn message",function(){
beautylog.success('beautylog.success(), with normal logText, without logType');
})
});
describe(".warn",function(){
it("should display a orange warn message",function(){
beautylog.warn('beautylog.warn(), with normal logText, without logType');
});
});
describe(".table",function(){
it("should print a nice table",function(){
(function(){
var testTable1 = beautylog.table.new("checks");
testTable1.push(['check1','success']);
testTable1.push(['check2','error']);
testTable1.push(['check3','error']);
testTable1.print();
const testLogContext: ILogContext = { var testTable2 = beautylog.table.new("custom",["Column1".red,"Column2".blue,"Column3".cyan]);
company: 'Lossless GmbH', testTable2.push(["Hey","this","works"]);
companyunit: 'Lossless.Cloud', testTable2.print();
containerName: 'gitlabci', })();
environment: 'staging', });
runtime: 'node', });
zone: 'shipzone', describe(".figlet",function(){
}; it("should print nice fonts to console in yellow",function(done){
beautylog.figlet("Async!",{font:"Star Wars",color:"yellow"}).then(done);
let testLocalInstance: smartlogDesinationLocal.DestinationLocal; })
});
tap.test('should create a valid instance of DestinationLocal', async () => { describe(".figletSync",function(){
testLocalInstance = new smartlogDesinationLocal.DestinationLocal(); it("should print nice fonts to console in yellow",function(){
expect(testLocalInstance).toBeInstanceOf(smartlogDesinationLocal.DestinationLocal); beautylog.figletSync("Sync!",{font:"Star Wars",color:"blue"});
})
});
}); });
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();

18
test/testbrowser.js Normal file
View File

@ -0,0 +1,18 @@
/// <reference path="typings/tsd.d.ts" />
var plugins = {
gulp: require("gulp"),
gulpBrowser: require("gulp-browser"),
easyserve: require("easyserve")
};
plugins.gulp.task('compileBrowserJS', function () {
var stream = plugins.gulp.src('test/browser/index.js')
.pipe(plugins.gulpBrowser.browserify())
.pipe(plugins.gulp.dest("test/browser/browserified/"));
return stream;
});
plugins.gulp.task('default', ['compileBrowserJS'], function () {
console.log('browserJS has been browserified');
plugins.easyserve("test/browser/");
});
plugins.gulp.start.apply(plugins.gulp, ['default']);
//# sourceMappingURL=testbrowser.js.map

1
test/testbrowser.js.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"testbrowser.js","sourceRoot":"","sources":["testbrowser.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,IAAI,OAAO,GAAG;IACV,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC,cAAc,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC;CAClC,CAAC;AAEF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;IAClC,IAAI,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC;SACjD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;SACtC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAC3D,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,CAAC,kBAAkB,CAAC,EAAE;IAC9C,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC/C,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC"}

20
test/testbrowser.ts Normal file
View File

@ -0,0 +1,20 @@
/// <reference path="typings/tsd.d.ts" />
var plugins = {
gulp: require("gulp"),
gulpBrowser: require("gulp-browser"),
easyserve: require("easyserve")
};
plugins.gulp.task('compileBrowserJS', function() {
var stream = plugins.gulp.src('test/browser/index.js')
.pipe(plugins.gulpBrowser.browserify())
.pipe(plugins.gulp.dest("test/browser/browserified/"));
return stream;
});
plugins.gulp.task('default',['compileBrowserJS'], function() {
console.log('browserJS has been browserified');
plugins.easyserve("test/browser/");
});
plugins.gulp.start.apply(plugins.gulp, ['default']);

View File

@ -1,8 +0,0 @@
/**
* 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'
}

49
ts/beautylog.classes.ts Normal file
View File

@ -0,0 +1,49 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./beautylog.plugins");
var tableHelpers = {
makeRow: function(cellCounterArg:number = 2,colorArg:string = "cyan"){
var rowArray = [];
for (var i = 0; i < (cellCounterArg); i++) {
rowArray.push(String(i + 1).cyan);
}
return rowArray;
}
};
export class ConsoleTable {
tableHead:string[];
rows;
type:string;
constructor(tableTypeArg:string,tableHeadArrayArg:string[] = tableHelpers.makeRow()) {
switch (tableTypeArg) {
case "checks":
this.tableHead = ['Check Item:'.cyan,'Status:'.cyan];
break;
case "custom":
this.tableHead = tableHeadArrayArg;
break;
default:
break;
}
this.rows = [];
this.type = tableTypeArg;
}
push(row:string[]){
this.rows.push(row);
}
print() {
var table = new plugins.cliTable({
head: this.tableHead
});
for (var row in this.rows){
if(this.rows[row][1] == "success"){
this.rows[row][1] = ' '.bgGreen + ' ' + this.rows[row][1];
} else if (this.rows[row][1] == "error") {
this.rows[row][1] = ' '.bgRed + ' ' + this.rows[row][1];
}
table.push(this.rows[row]);
};
console.log(table.toString());
}
}

39
ts/beautylog.figlet.ts Normal file
View File

@ -0,0 +1,39 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./beautylog.plugins");
var defaultOptions = {
font:"Star Wars",
color: "green",
cb: function(){}
};
export var figlet = function(textArg:string,optionsArg?){
var done = plugins.q.defer();
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
var 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(data[options.color]);
options.cb();
done.resolve();
});
return done.promise;
};
export var figletSync = function(textArg:string,optionsArg?){
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
var options = plugins.lodash.assign(mergeOptions,optionsArg);
console.log(plugins.figlet.textSync(textArg,{
font: options.font,
horizontalLayout: 'default',
verticalLayout: 'default'
})[options.color]);
return true;
};

114
ts/beautylog.log.helpers.ts Normal file
View File

@ -0,0 +1,114 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./beautylog.plugins");
var localBl = {
dirPrefix: plugins.clc.bgXterm(39).xterm(231).bold(' DIR ') + ' ',
errorPrefix: ' Error: '.bgRed.white.bold + ' ',
infoPrefix: plugins.clc.bgXterm(198).xterm(231).bold(' INFO ') + ' ',
normalPrefix: ' Log: '.bgCyan.white.bold + ' ',
okPrefix: ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ',
successPrefix: ' Success: '.bgGreen.white.bold + ' ',
warnPrefix: ' '.bgYellow + ' Warn: '.bgBlack.yellow.bold + ' '
};
/**
*
* @param logText
* @param logType
* @returns {boolean}
*/
export let log = function(logText:string = 'empty log', logType:string = 'normal') {
switch(plugins.smartenv.getEnv().runtimeEnv) {
case "node":
logNode(logText,logType);
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 logNode = function(logText:string,logType:string){
try {
switch (logType) {
case 'dir':
logText = localBl.dirPrefix + plugins.clc.xterm(26)(logText);
break;
case 'error':
logText = localBl.errorPrefix + logText.red.bold;
break;
case 'info':
logText = localBl.infoPrefix + plugins.clc.xterm(198)(logText);
break;
case 'normal':
logText = localBl.normalPrefix + logText.cyan.bold;
break;
case 'ok':
logText = localBl.okPrefix + logText.bold;
break;
case 'success':
logText = localBl.successPrefix + logText.green.bold;
break;
case 'warn':
logText = localBl.warnPrefix + logText.bold;
break;
case 'log':
logText = localBl.normalPrefix + logText.blue.bold;
break;
default:
logText.blue.bold;
console.log(('unknown logType for "' + logText + '"').red.bold);
break;
}
console.log(logText);
return true;
}
catch (error) {
console.log(localBl.errorPrefix + 'You seem to have tried logging something strange'.red.bold + error);
return false;
}
}
let logBrowser = function(logText,logType){
switch (logType) {
case 'dir':
logText = localBl.dirPrefix + plugins.clc.xterm(26)(logText);
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.normalPrefix + 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;
}
};

58
ts/beautylog.log.ts Normal file
View File

@ -0,0 +1,58 @@
/// <reference path="./typings/main.d.ts" />
import {log} from "./beautylog.log.helpers";
export {log} from "./beautylog.log.helpers";
/**
* logs an info to console
* @param logText
* @returns {boolean}
*/
export let info = function (logText) {
return log(logText, 'info');
};
/**
* logs an 'OK!' message to console
* @param logText
* @returns {boolean}
*/
export let ok = function (logText) {
return log(logText, 'ok');
};
/**
* logs a success to console
* @param logText string to log as error
* @returns {boolean}
*/
export let success = function (logText) {
return log(logText, 'success');
};
/**
* logs a 'warn:' message to console
* @param logText string to log as error
* @returns {boolean}
*/
export let warn = function (logText) {
return log(logText, 'warn');
};
/**
* logs an error to console
* @param logText
* @returns {boolean}
*/
export let error = function (logText) {
return log(logText, 'error');
};
/**
* logs an directory to console
* @param logText
* @returns {boolean}
*/
export let dir = function (logText) {
return log(logText, 'dir');
};

16
ts/beautylog.plugins.ts Normal file
View File

@ -0,0 +1,16 @@
/// <reference path="./typings/main.d.ts" />
var plugins:any = {
lodash: require("lodash"),
smartenv: require("smartenv"),
q: require("q")
};
if (plugins.smartenv.getEnv().isNode){
plugins = plugins.lodash.assign(plugins,{
cliTable: require("cli-table2"),
colors: require("colors"),
clc: require("cli-color"),
figlet: require("figlet")
});
}
export = plugins;

9
ts/beautylog.table.ts Normal file
View File

@ -0,0 +1,9 @@
/// <reference path="./typings/main.d.ts" />
import classes = require("./beautylog.classes");
export let table = {
new: function(typeArg:string,tableHeadArrayArg?) {
var newConsoleTable = new classes.ConsoleTable(typeArg,tableHeadArrayArg);
return newConsoleTable;
}
};

View File

@ -1,135 +0,0 @@
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,2 +1,36 @@
// export classes /// <reference path="./typings/main.d.ts" />
export { DestinationLocal } from './classes.destinationlocal.js';
import * as plugins from "./beautylog.plugins";
import * as classes from "./beautylog.classes";
import * as BeautylogLog from "./beautylog.log";
import * as BeautylogFiglet from "./beautylog.figlet"
import * as BeautylogTable from "./beautylog.table";
let beautylog = {
log: BeautylogLog.log,
info: BeautylogLog.info,
ok: BeautylogLog.ok,
success: BeautylogLog.success,
warn: BeautylogLog.warn,
error: BeautylogLog.error,
dir: BeautylogLog.dir,
figlet: BeautylogFiglet.figlet,
figletSync: BeautylogFiglet.figletSync,
table: BeautylogTable.table
};
/*switch(plugins.smartenv.getEnv().runtimeEnv) {
case "node":
beautylog = BeautylogNode;
break;
case "browser":
beautylog = BeautylogBrowser;
break;
default:
console.log("something is strange about the platform in which you try to use beautylog");
break;
}*/
export = beautylog;

View File

@ -1,5 +0,0 @@
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 };

7
ts/typings.json Normal file
View File

@ -0,0 +1,7 @@
{
"ambientDependencies": {
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts"
}
}

View File

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