2.0.2 โ€ข Published 10 months ago

@frankhoodbs/logging-utilities v2.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months 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.

2.0.2

10 months ago

2.0.1

10 months ago

1.4.12

10 months ago

1.4.11

11 months ago

1.4.9

1 year ago

1.4.10

1 year ago

1.4.4

1 year ago

1.4.8

1 year ago

1.4.7

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.16

1 year ago

1.3.13

1 year ago

1.3.14

1 year ago

1.3.15

1 year ago

1.3.12

1 year ago

1.3.10

1 year ago

1.3.11

1 year ago

1.3.9

1 year ago

1.3.8

1 year ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.2.1

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.16

2 years ago

1.1.13

2 years ago

1.1.5

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago