# footstep

> a simple robust nodejs logger

Latest version **2.0.0** (published 2018-05-31) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-05-31 |
| First published | 2018-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 21.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | HamiStudios |
| Maintainers | y0hami |
| Keywords | logger |

## Links

- npm: https://www.npmjs.com/package/footstep
- Repository: https://github.com/HamiStudios/footstep
- Homepage: https://github.com/HamiStudios/footstep#readme
- Issues: https://github.com/HamiStudios/footstep/issues
- npm.io page: https://npm.io/package/footstep

## 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
- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K 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

## Recent versions

- 2.0.0 (latest) — 2018-05-31
- 1.0.1 — 2018-03-17
- 1.0.0 — 2018-02-10

## README

# footstep  
footstep is a simple robust logger for [nodejs](https://nodejs.org/en/)  
  
  
### Installation  
```  
$ npm install --save footstep  
```  
  
### Setup  
```javascript  
const { Logger } = require("footstep");  
  
let logger = new Logger(options);  
```  
  
### Usage  
```javascript  
logger.verbose("Hello World");  // => [10:34:35] verbose: Hello World  
logger.info("Hello World");     // => [10:34:35] info: Hello World  
logger.error("Hello World");    // => [10:34:35] error: Hello World  
logger.warning("Hello World");  // => [10:34:35] warning: Hello World  
logger.notice("Hello World");   // => [10:34:35] notice: Hello World  
logger.debug("Hello World");    // => [10:34:35] debug: Hello World  
logger.log("Hello World");      // => [10:34:35] log: Hello World  
  
  
// verbose & debug will not execute if they  
// aren't enabled. You can enable/disable them  
// via the options or the following functions.  
logger.setVerbose(true);  
logger.setDebug(true);  
```
  
#### Options  
Footstep comes with a lot of useful options to help customize your log messages including, custom streams, prefixes and functional expansions.   
  
| variables       | default                                            | type     |
|-----------------|----------------------------------------------------|----------|
| streams.verbose | process.stdout                                     | Stream   |
| streams.info    | process.stdout                                     | Stream   |
| streams.error   | process.stderr                                     | Stream   |
| streams.warning | process.stdout                                     | Stream   |
| streams.notice  | process.stdout                                     | Stream   |
| streams.debug   | process.stdout                                     | Stream   |
| streams.log     | process.stdout                                     | Stream   |
| format          | [{{date}}] {{type}}: {{message}}                   | String   |
| formats.date    | [Function() {}](/src/Logger.js#L59)                | Function |
| formats.message | [Function() {}](/src/Logger.js#L71)                | Function |
| formats.prefix  | [Function() {}](/src/Logger.js#L76)                | Function |
| formats.type    | [Function() {}](/src/Logger.js#L81)                | Function |
| prefix          |                                                    | String   |
| eol             | [os.EOL](https://nodejs.org/api/os.html#os_os_eol) | String   |
| debug           | false                                              | Boolean  |
| verbose         | false                                              | Boolean  |

#### Custom expansions  
  
You can create custom function expansions by adding a new function to `formats`  
  
```javascript  
const  
  options = {
    format  : '[{{dow}}] {{message}}',
    formats : {
      dow     : function() {
	    let
	      days  = ['Sunday','Monday','Tuesday',
	               'Wednesday','Thursday','Friday', 
	               'Saturday'],
	      date  = new Date()
	    ;
        return days[date.getDay()];  
      }  
    }
  }
;
```  
  
Output:  
`[Thursday] Hello World`  
  
  
#### Streams  
  
You can set the stream to anything with the instance of [`Stream`](https://nodejs.org/api/stream.html) including process.stdout, process.stderr, fs streams, HTTP streams etc.


### Colors
Footstep has built in support for colors and styles with help & similar syntax to [colors.js](https://github.com/Marak/colors.js).

#### Usage
```javascript  
const { Colors } = require("footstep");

console.log('I am red and underlined'.red.underline);  
console.log('I am blue and bold'.blue.bold);  
console.log('I am black with a white background'.black.bg_white);  
console.log('I am black with a red background'.red.inverse);
console.log(color.strip('I am no color'.yellow));
```

#### List of colors & styles
- .reset
- .black
- .blue
- .cyan
- .gray
- .green
- .grey
- .magenta
- .red
- .white
- .yellow
- .bg_black
- .bg_blue
- .bg_cyan
- .bg_gray
- .bg_green
- .bg_grey
- .bg_magenta
- .bg_red
- .bg_white
- .bg_yellow
- .bold
- .dim
- .hidden
- .inverse
- .italic
- .strikethrough
- .underline

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