# plog

> p - A small global logging utility for faster debugging

Latest version **0.3.0** (published 2020-01-16) · WTFPL license · 0 weekly downloads

## Install

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

Provides the command `plog`.

## 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.3.0 |
| Published | 2020-01-16 |
| First published | 2012-12-06 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Rasmus Porsager |
| Maintainers | porsager |

## Links

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

## Dependencies (1)

- [prexit](https://npm.io/package/prexit.md) 0.0.5

## Recent versions

- 0.3.0 (latest) — 2020-01-16
- 0.0.2 — 2020-01-16
- 0.2.1 — 2013-06-24
- 0.2.0 — 2013-06-24
- 0.1.1 — 2013-06-18
- 0.1.0 — 2013-06-18
- 0.0.4 — 2012-12-06
- 0.0.3 — 2012-12-06
- 0.0.1 — 2012-12-06

## README

> Your new best friend when developing, and probably ONLY for development
 
[![version](https://img.shields.io/npm/v/plog.svg)]() [![license](https://img.shields.io/github/license/porsager/plog.svg)]()

# 🐞 `p()` 

```js
p('Awesome!!')          // Logs awesome

fetch('https://cats')
.then(x => x.json())
.then(p)                // Logs the json result
.then(store)

a.neat().p.chain.p.here // Logs result of `neat` and `chain`

const wat = p`wat`

wat('is going on')      // Logs `wat is going on`
```

This module adds a global `p` and global `plog`* variable which is a convenience method for logging.

It simply defers to console.log, but returns the first argument instead of `undefined`.

If it is called as a tagged template literal it will return a new `p` function that always prefixes logs with the value in the template literal.

It also adds `p` and `plog` to Object.prototype to enable even quicker logging. This way you can jump into a chain at any place to log the value and continue with your program as if nothing happened.

\* (for times when p is shadowed)

### Example require

##### Node at launch
```bash
node -r plog index.js   # -r option is short for --require
```

##### Browser
```js
<script src="https//unpkg.com/plog">
```

##### Node in file
```js
require('plog')         // Adds the global p
```

##### Node global
You can use `plog` in place of node which is just a shortcut for `node -r plog ...`
```bash
plog index.js
```

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