<commit_before># custom-logger

`custom-logger` is a simple, highly customizable logging plugin for node.js.

To install this module simply run:

```bash
npm install custom-logger
```

I'm still very much still learning node.js, and this is my first "official" module. If you notice any unusual or depracated coding behaviors be sure to let me know, like I said, I'm still learning! (:

If you have any questions or feedback, or need any help using this module, please contact <a href="http://twitter.com/#!/felix_mc" target="_blank">@felix_mc</a>.


## Basic Usage

```javascript
var log = require('custom-logger').config({ level: 0 });

log.debug( 'hello?' );
	
log.info( 'hello world!' );

log.warn( 'carefule there, world!' );
	
log.error( 'WHOA WHOA WHOA world?!' );
```

The above code will render to: 

![basic output snapshot](https://github.com/felixmc/custom-logger/raw/master/snapshots/basic.png)

`custom-logger` uses logging levels and different event types to determine what is being outputed at any given time. Below are the default events and their respective logging levels:

	0 => debug
	1 => info
	2 => warn
	3 => error

As you can see above, you can use the level parameter in the config method to set the current logging level. You can call on the config method on the log object at any time throughout your code to change the log level or other options.

`custom-log` will only show events whose level is **equal to or higher** than the one set. For example a level of `0` will show all event types, whereas a level of `2` will only show the event types `warning` and `error`. By default the logging level is `0`.

You can pass any number of parameters to logging methods (like log.info() or log.error), regardless of whether they are a default method or one that you created (see below). custom-logger will join all parameters together in one string, converting JSON and other non-string parameters to strings automatically.

## Customizing Events Types

One cool thing you can do with `custom-logger` is you easily create your own additional event types:

```javascript
log.new({
	fatal: { level: 5, event: "fatal", color: "rainbow" }<commit_msg>Add message formatting example to README<commit_after># custom-logger

`custom-logger` is a simple, highly customizable logging plugin for node.js.

To install this module simply run:

```bash
npm install custom-logger
```

I'm still very much still learning node.js, and this is my first "official" module. If you notice any unusual or depracated coding behaviors be sure to let me know, like I said, I'm still learning! (:

If you have any questions or feedback, or need any help using this module, please contact <a href="http://twitter.com/#!/felix_mc" target="_blank">@felix_mc</a>.


## Basic Usage

```javascript
var log = require('custom-logger').config({ level: 0 });

log.debug( 'hello?' );
	
log.info( 'hello world!' );

log.warn( 'carefule there, world!' );
	
log.error( 'WHOA WHOA WHOA world?!' );

log.config({
	messageFormatting: true
});

log.info("I see %d %s!", 3, "bananas"); // Outputs "I see 3 bananas!"
```

The above code will render to: 

![basic output snapshot](https://github.com/felixmc/custom-logger/raw/master/snapshots/basic.png)

`custom-logger` uses logging levels and different event types to determine what is being outputed at any given time. Below are the default events and their respective logging levels:

	0 => debug
	1 => info
	2 => warn
	3 => error

As you can see above, you can use the level parameter in the config method to set the current logging level. You can call on the config method on the log object at any time throughout your code to change the log level or other options.

`custom-log` will only show events whose level is **equal to or higher** than the one set. For example a level of `0` will show all event types, whereas a level of `2` will only show the event types `warning` and `error`. By default the logging level is `0`.

You can pass any number of parameters to logging methods (like log.info() or log.error), regardless of whether they are a default method or one that you created (see below). custom-logger will join all parameters together in one string, converting JSON and other non-string parameters to strings automatically.

## Customizing Events Types

One cool thing you can do with `custom-logger` is you easily create your own additional event types:

```javascript
log.new({
	fatal: { level: 5, event: "fatal", color: "rainbow" }
{'fraction_non_alphanumeric': 0.09395224280294577, 'fraction_numerical': 0.004463289444320465, 'mean_word_length': 4.329369797859691, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '158904', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1203, 'n_words': 645}