1.4.3 โ€ข Published 6 days ago

@frankhoodbs/logging-utilities v1.4.3

Weekly downloads
-
License
ISC
Repository
-
Last release
6 days ago

@frankhoodbs/logging-utilities

A collection of utilities for logging crafted with love by Frankhood Business Solutions s.r.l..

Version License

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',
});

Component Screenshot

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,
});

Component Screenshot

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',
    },
});

Component Screenshot

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,
});

Component Screenshot

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: #35494E #41B883
  • green: #41B883 #FFFFFF
  • orange: #5E3535 #ECA70A
  • purple: #a86cba #ddc9e4
  • purple2: #a86cba #ffffff
  • red: #9C7F3D #FF3311
  • red2: #5E3535 #FF3311
  • blue: #1F351E #1188FF
  • blue2: #1188FF #ffffff

Component Screenshot

However, you can also provide your own custom theme when logging.

License

This project is licensed under the ISC License.

1.4.3

6 days ago

1.4.2

19 days ago

1.4.1

22 days ago

1.4.0

23 days ago

1.3.16

23 days ago

1.3.13

2 months ago

1.3.14

2 months ago

1.3.15

2 months ago

1.3.12

2 months ago

1.3.10

3 months ago

1.3.11

3 months ago

1.3.9

4 months ago

1.3.8

4 months ago

1.3.7

4 months ago

1.3.6

4 months ago

1.3.5

4 months ago

1.3.2

4 months ago

1.3.1

4 months ago

1.2.0

7 months ago

1.1.9

8 months ago

1.2.1

7 months ago

1.1.12

8 months ago

1.1.11

8 months ago

1.1.10

8 months ago

1.1.16

7 months ago

1.1.13

7 months ago

1.1.5

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago