npm package: @gameland-team/tslogging
Description: A custom logging system made in TS
Author: gameland-team
Latest version: 1.2.3-jstest8-fix

# tslogging: A custom lightweight logger made in TypeScript
Welcome to **tslogging** repository!

**tslogging** aims to be as lightweight as possible while being as feature-rich as possible. **tslogging** has 5 logging levels: Info, Warn, Error, Fatal and Debug, which can be turned off at any time. There are also some additional logging types (Grouping, etc. (more to be implemented)). You can turn off warning messages while keeping info on, and more. Also, **tslogging** has been fixed and is currently working as a bare bones logging system, and is quite configurable.

Now supports stdout printing instead of using console to print line for all logging levels!

*(tslogging is currently using JavaScript by compiling with tsc. Please tell us if any bugs arise!)*

# Usage
First, import the project and initialize Logger with:
```ts
const logger = new Logger(); // Logger w/ default options

// Logger with custom options
const logger = new Logger({
    "prefix": (Your desired prefix here),
    "showDate": (true/false),
    "showTime": (true/false),
    "useStdoutInstead": (true/false),
    "loggingLevel": {
        "info": (true/false),
        "debug": (true/false),
        "warn": (true/false),
        "error": (true/false),
        "fatal": (true/false),
        "group": (true/false)
    }
}); 
```

Now, you can use your freshly initialized Logger.

```ts
logger.info("Should be printing out a line");
```

This will print out a line of 
```
[MM-dd-yyyy hh:mm:ss] Test Logger | INFO > Should be printing out a line
```

## Outputting
Given the code below with all the logging levels ; You can see what the output is below the code.

```ts
const logger = new Logger({
    "showTime": true,
    "showDate": false,
    "prefix": "Test logger"
});

// Information output
logger.info("This is info!");

// For debugging purposes
logger.debug("This is just a random debug.");

// Just for warning something
logger.warn("It's yellow because it's a warning!");

// Error and fatal specifically. Not for printing messages, though, but instead, errors.
try {
    throw new Error('A test error!')
} catch (err) {
    logger.error(err);
    logger.fatal(err);
}

logger.group("Test group", ["The first element!"]);
```

Here is the output (hh:mm:ss is the time and directories removed in stacktracing on the README, so if you execute logger.error/fatal, it should show the directories):
```
[hh:mm:ss] Test logger | INFO > This is info!
[hh:mm:ss] Test logger | DEBUG > This is just a random debug.
[hh:mm:ss] Test logger | WARN > It's yellow because it's a warning!
[hh:mm:ss] Test logger | ERROR > Error: A test error!
    at Object.<anonymous> 
    at Module._compile 
    at Module.m._compile 
    at Module._extensions..js 
    at Object.require.extensions.<computed> [as .ts]
    at Module.load
    at Function.Module._load
    at Function.executeUserEntryPoint [as runMain] 
    at main 
    at Object.<anonymous>
[hh:mm:ss] Test logger | FATAL > Error: A test error!
    at Object.<anonymous> 
    at Module._compile 
    at Module.m._compile 
    at Module._extensions..js
    at Object.require.extensions.<computed> [as .ts]
    at Module.load 
    at Function.Module._load
    at Function.executeUserEntryPoint [as runMain] 
    at main 
    at Object.<anonymous> 
[hh:mm:ss] Test logger | GROUP > Elements for group Test group:
Test group | The first element!
[hh:mm:ss] Test logger | GROUP > End of group.
```

## Custom colored output
Thanks to chalk, you can print out custom colored console stuff by doing so:

```ts
import { colors, Logger } from "@gameland-team/tslogging";

// const logger = ... (initialize logger here)

logger.info(colors.red("This is a log with red color"))
```

And it should print out a line of information with the message "This is a log with red color" in the color red.

*(If you want to visit the chalk npm page, click [here](https://www.npmjs.com/package/chalk)).*

## Dependencies/Dependents
You can find all the dependencies used by tslogging on the *Dependencies* tab. If you are looking for **tslogging dependents** instead, you can go on the *Dependents* tab.