@frankhoodbs/logging-utilities v2.0.2
@frankhoodbs/logging-utilities
A collection of utilities for logging crafted with love by Frankhood Business Solutions s.r.l..
Features
- Pre-defined Emoji icons for expressive logging.
- Flexible and themed logging with colorful outputs.
- Extensible with custom themes.
Installation
Using npm:
npm install @frankhoodbs/logging-utilities
Usage
Import the Utility
import {
colorLog,
progressBar,
zzz,
ok,
brain,
} from '@frankhoodbs/logging-utilities';
Basic Logging
colorLog({
icon: zzz,
label: 'INFO',
message: 'This is a basic log message',
});
Progress Logging
const percentageCount = (fractionValue / totalValue) * 100;
const percentage = isNaN(percentageCount) ? 0 : percentageCount;
//we divide by 3 to make the bar a bit less wide
const barProportion = 3;
const done = parseInt(percentage / barProportion, 10);
const missing = 100 / barProportion - done;
const emptyOrFull = percentage === 0 || percentage === 100;
const label = `My custom label -> ${percentage.toFixed(
0
)}% (${fractionValue} / ${totalValue})`;
const isLabelBeforeBar = false;
progressBar({
done,
missing,
emptyOrFull,
label,
isLabelBeforeBar,
});
Themed Logging
colorLog({
icon: brain,
label: 'DEBUG',
message: 'Using the vue theme',
themeName: 'vue',
});
colorLog({
icon: ok,
label: 'SUCCESS',
message: 'Using a custom theme',
theme: {
backgroundColorLeft: '#FF0000',
backgroundColorRight: '#00FF00',
colorLeft: '#FFFFFF',
colorRight: '#000000',
},
});
Status Logging
colorLog({
label: 'REJECTED',
message: 'A task is rejected',
status: -1,
});
colorLog({
label: 'PENDING',
message: 'A task is pending',
status: 0,
});
colorLog({
label: 'PASSED',
message: 'A task is passed',
status: 1,
});
Available Icons
For your convenience, the following pre-defined icons are available:
zzz
: ๐คbomb
: ๐ฃprohibited
: ๐ซok
: โrightArrow
: ๐ซinfo
: โน๏ธbrain
: ๐งpop
: ๐wait
: โณcomet
: โ๏ธbell
: ๐
Certamente! Una delle maniere per farlo in un file README.md su GitHub รจ utilizzare badge colorati fatti con le righe di codice Markdown. Ecco un esempio di come potrebbe apparire:
Available Themes
The following themes are predefined and ready to use:
- vue:
- green:
- orange:
- purple:
- purple2:
- red:
- red2:
- blue:
- blue2:
However, you can also provide your own custom theme when logging.
License
This project is licensed under the ISC License.
10 months ago
10 months ago
10 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago