# consoleit

> Utility to append console messages to the DOM. Useful when using RequireBin, JSFiddle, or the like.

Latest version **0.0.6** (published 2014-12-09) · MIT license · 0 weekly downloads

## Install

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

## 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.0.6 |
| Published | 2014-12-09 |
| First published | 2014-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | YuzuJS |
| Maintainers | donavon |
| Keywords | console, log, requirebin, jsfiddle |

## Links

- npm: https://www.npmjs.com/package/consoleit
- Repository: https://github.com/YuzuJS/consoleit
- Issues: https://github.com/YuzuJS/consoleit/issues
- npm.io page: https://npm.io/package/consoleit

## Dependencies (1)

- [insert-css](https://npm.io/package/insert-css.md) ^0.2.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.0.6 (latest) — 2014-12-09
- 0.0.5 — 2014-12-01
- 0.0.4 — 2014-12-01
- 0.0.3 — 2014-11-26
- 0.0.2 — 2014-11-25
- 0.0.1 — 2014-11-25

## README

ConsoleIt!
=========

Utility to append console messages to the DOM. Useful when using RequireBin, JSFiddle, or the like.

###RequireBin
Example usage in RequireBin:
```javascript
var console = require("consoleit");
console.log("This will appear in the DOM just like magic!");
```

###JSFiddle
To use this in JSFiddle, you must also add the following script tag to your HTML:
```html
<script src="http://wzrd.in/bundle/consoleit"></script>
```
Then use the JavaScript code as shown above.

###Methods
ConsoleIt supports the following methods:

| Method          | Description                                |
| --------------- | :----------------------------------------- |
| console.log()   | For general output of logging information. |
| console.info()  | Informative logging information.           |
| console.warn()  | Outputs a warning message.                 |
| console.error() | Outputs an error message.                  |

Colored icons are placed next to all but `console.log()` as follows:

![alt text](https://github.com/YuzuJS/consoleit/raw/master/console-output.png "Example Console Output")

###String Substitution

You can also use the following string substitution characters in your output.

| Substitution string | Description                     |
| ------------------- | :------------------------------ |
| %d or %i            | Outputs an integer.             |
| %s                  | Outputs a string.               |
| %f                  | Outputs a floating-point value. |

See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions) for further details.

```JavaScript
console.log("Only %d days until %s!", 30, "Christmas");
```

###JavaScript Objects

JavaScript obects will be converted to JSON.

For example:
```JavaScript
var obj = {x:1, y:2};
console.log(obj);
```

Would display:
```
Object {"x":1,"y":2}
```

###Options

By default, output will be appended to the `document.body`.
You can optionally send the output to a particular element.
Simply pass the element id (as a string) to ConsoleIt as shown below.

```html
<div id="log"></div>
```

```javascript
var console = require("consoleit")("log");
console.log("This will be appended to the 'log' div.");
```

###For use under [MIT license](http://github.com/YuzuJS/consoleit/raw/master/LICENSE)

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