# noogger

> Writes log files for nodejs modules/applications

Latest version **0.1.8** (published 2017-09-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install noogger
pnpm add noogger
yarn add noogger
bun add noogger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2017-09-05 |
| First published | 2016-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ismael OUEDRAOGO |
| Maintainers | xsmael |
| Keywords | log, logs, file, write, logger, logging, node, application, console, info, debug, warning, error |

## Links

- npm: https://www.npmjs.com/package/noogger
- Repository: https://github.com/Xsmael/node-logger
- Issues: https://github.com/Xsmael/node-logger/issues
- npm.io page: https://npm.io/package/noogger

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [moment](https://npm.io/package/moment.md) ^2.13.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.1.8 (latest) — 2017-09-05
- 0.1.7 — 2017-03-30
- 0.1.6 — 2017-02-21
- 0.1.5 — 2017-02-21
- 0.1.4 — 2016-08-08
- 0.1.3 — 2016-05-26
- 0.1.2 — 2016-05-06
- 0.1.1 — 2016-05-06
- 0.1.0 — 2016-05-06
- 1.0.0 — 2016-04-28

## README

# node-logger (noogger)

A simple logging module for node.js


[![Build Status](https://travis-ci.org/websockets/ws.svg?branch=master)](https://travis-ci.org/websockets/ws)

`noogger` is a simple featured logger module that helps you displaying logs to the console with log levels and pretty colors
 as well as writing logs files in a clean an organized way.
No need to implement the logging mechanism for your node applications anymore.


### Installing
Install it locally in your project or globally:
```
npm install noogger
npm install -g noogger
```

## Features

-  write daily log file, handy for servers, or applications that run continously
-  Forwards(prints) logging data to the console output if needed (optional)
-  En/Disable Console output with respect to log levels 
-  En/Disable File output with respect to log levels 
-  pretty colors in console output
-  Supported log levels (as per cisco and many other manufacturer standards):
	EMERGENCY(0)
	ALERT(1)
	CRITICAL(2)
	ERROR(3)
	WARNING(4)
	NOTICE(5)
	INFO(6)
	DEBUG(7)
-  Customize date-time format for log lines and for log file name

## Usage

#### Basic (with default parameters)

```js
var log = require('noogger');
...
...
log.emergency("This is an EMERGENCY!!! THE WORLD IS COLLAPSING");
log.alert("OMGGGG!");
log.critical("This is getting critical!");
log.error("Erro 0x04512 Failed to initialize the initialization module");
log.warning("something is wrong");
log.notice("Hey! have you noticed This?!");
log.info("Hello World! Booting..");
log.debug("something Happened!");

```
The log file will look like this
```
28-04-2016 20:16:45.5 [WARNING] something is wrong
28-04-2016 20:16:45.5 [ERROR] Failed to initialize the...
28-04-2016 20:16:45.5 [DEBUG] something Happened!
28-04-2016 20:17:06.6 [ERROR] telnet socket closed
```

#### With custom options

```js
var logParams = {
	consoleOutput : true,
	consoleOutputLevel: ['DEBUG','ERROR','WARNING'],
	
	dateTimeFormat: "DD-MM-YYYY HH:mm:ss.S",
	outputPath: "logs/",
	fileNameDateFormat: "DDMMYYYY",
	fileNamePrefix:"myApp-"
};

var log = require('noogger').init(logParams);

```
or
```js
var log = require('noogger');

var logParams = {
	consoleOutput : true,
	consoleOutputLevel:'DEBUG',
	
	dateTimeFormat: "DD-MM-YYYY HH:mm:ss",
	fileNameDateFormat: "YYYY-MM-DD",
	fileNamePrefix:"myApp-",
	outputPath: "myLogs/"
};


log.init(logParams);
```

## Default Parameters: 
```
	consoleOutput : true,
	consoleOutputLevel: 7, 
	
	fileOutput: true,
	fileOutputLevel: 7, 
	
	outputPath: "logs/",
	fileNameDateFormat: "DDMMYYYY",
	dateTimeFormat: "DD-MM-YYYY HH:mm:ss.S",
	
	fileNamePrefix:"",
	fileNameSuffix:"",
	customIntro: null
```

## Parameters: 
-  	`consoleOutput` : `boolean` : Wether the logs should be printed on the console output as well, or not
-  	`consoleOutputLevel` : `int` or `string` or `array`  : Filters what is printed to the console with respect to log levels (specify the console output log level).
   	using int: from 0 to 7 
  	using string: any valid log level (DEBUG, INFO, ERROR,....)
  	using array: to allow to select multiple log levels without the constraint of order  eg: ['DEBUG','ERROR','WARNING']
-  	`fileOutput` : `boolean` : Wether the logs should be written to files or not
-  	`consoleOutputLevel` : `int` or `string` or `array`  : Filters what is written to log files with respect to log levels (works the same as consoleOutputLevel).
-  	`outputPath` : `string` : define the location where the log files  will be written
-  	`dateTimeFormat` : `string` : specifies the Date and time format to be used inside log file for each record.
                             refer to the date format section.
-  	`fileNameDateFormat`: `string` : the date format to be used in the log files name to differentiate them (per day); 
                               you can alter this, so that it will write one file per week or month or whatever you want,
                               refer to the date format section.
-  	`fileNamePrefix`: `string` : Prepends the given string to every log file name.
-  	`fileNameSuffix`: `string` : Appends the given string to every log file name.
-  	`customIntro`: `function` or `boolean` : Just. try it by stting it to true :) or supply your own function to be called when your application starts(at least at the point where you initialize noogger)


## Date and Time formatting

The formating is based on the moment.js library, since it is the one used.
So please refer to [this page][1].

Submit any issue or request to the [github page][2].

[1]: http://momentjs.com/docs/#/displaying/format/
[2]: https://github.com/Xsmael/node-logger/issues

---
_Source: https://npm.io/package/noogger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
