1.1.14 • Published 3 years ago

bxclog v1.1.14

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

BXCLog

BeXCool Logger
A simple logging utility module

How to use

Options

Note: Some options may have a different syntax to better match the language

locale

Type: string
Default: "auto"
Any locale code (eg. en-GB, de-DE, en-US)
Use "auto" to set automatically from OS.

timeZone

Type: string
Default: "auto"
Any timezone
Use "auto" to set automatically from OS.

brackets

Type: string
Default: "[]"
Which type of brackets to use.
Available options (Note: Any field is a valid option)

ShapeNameCharacter
roundparentheses( )
squarebox
bracescurly{ }
anglechevrons< >

saveToFile

Type: boolean
Default: false
Should the log be saved into a file?

saveFilePath

Type: string
Default: "logs"
Where should the file be saved?
SaveToFile must be enabled for this to have effect.
Relative to the entry point (eg. index.js, app.exe, ...).

showDebug

Type: boolean
Default: true
Changes whether the debug method displays anything.
Should be changed by the value of an environment variable (eg. environment == "release")

Javascript

Install with npm:
npm install bxclog

Example code:

const { BXCLog } = require("bxclog");

/**
 * This BXCLog instance should be stored in a file like "lib.js" 
 * in the exports object.
 * You can save a lot of performance and resources by doing that, 
 * because creating new instances every time you need to log 
 * something will have a negative impact on performance
 */
const bxclogger = new BXCLog({
    saveToFile: true,
    brackets:   "<>",
});

const service = "CatsService";
bxclogger.debug("process.argv", process.argv.join(", "));
bxclogger.info(service, "purr... meow, meow!", "we think the number", Math.random(), "is really cool... meow 😺");
bxclogger.warn(service, 
  "The cats are hungry", "\n", "You better go feed them right now \n", 
  "They also said that they need exactly this many kilos of food:", 68429796945127451n, "...it should be enough for about one and a half days 😼");
bxclogger.error(service, "The cats are really hungry and are starting to delete your programs 😠 Go feed them right now 🚔👮‍♂️");

Typescript

Install with npm:

npm install bxclog

Example code:

import { BXCLog } from "bxclog";

/**
 * You can copy the rest of the code from Javascript, 
 * The only difference is that instead of the "exports" object you use es6 export ("export const bxclogger = ...")
 */
1.1.14

3 years ago

1.1.13

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.0.2

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago