# @pwntheon/ez-pz-log

> A small tool that allows you to filter out which console.log messages to see based on tags

Latest version **1.1.1** (published 2020-08-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install @pwntheon/ez-pz-log
pnpm add @pwntheon/ez-pz-log
yarn add @pwntheon/ez-pz-log
bun add @pwntheon/ez-pz-log
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2020-08-22 |
| First published | 2020-08-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Aksel Ladegaard |
| Maintainers | pwntheon |
| Keywords | log, filter, logging, console |

## Links

- npm: https://www.npmjs.com/package/@pwntheon/ez-pz-log
- npm.io page: https://npm.io/package/@pwntheon/ez-pz-log

## 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

- 1.1.1 (latest) — 2020-08-22
- 1.1.0 — 2020-08-22
- 1.0.2 — 2020-08-20
- 1.0.1 — 2020-08-20
- 1.0.0 — 2020-08-19

## README

[![npm (scoped)](https://img.shields.io/npm/v/@pwntheon/ez-pz-log)](https://www.npmjs.com/package/@pwntheon/ez-pz-log)
[![github](https://img.shields.io/github/v/tag/pwntheon/ez-pz-log?label=github)](https://github.com/Pwntheon/ez-pz-log)

# ez-pz-log
A small tool that allows you to filter out which console.log messages to see based on tags

**Note:** Should work in node, but i haven't tested it.

## Usage
In your code, import ez-pz-log and use it like console.log, with the first argument being the tag. Logged messages will not be printed to console unless the tag is added to the list of tags to show.

In the app:
```javascript
import log from '@pwntheon/ez-pz-log';
const count = 4;
log("math", "count is equal to", count);
log("debug", "some debug info");
```

In the console when running your app:
```javascript
ezpzlog("math");
-> Added tag math
-> Currently tracked tags: math
```
If the above code is then hit, only the message with `math` as it's tag will be printed.

**Note:** the ezpzlog function will be added to the window object upon the first call of log(), so it's probably a good idea to add it to your app's initialization code.

Tags will be saved to local storage, so refreshing the page or changing your code will not clear the list of watched tags.

To remove a tag, just type `ezpzlog("tagname")` again.

## Functions other than console.log

If you wish to do console.warn, console.table or some other logging function, you can do this in two ways.

To switch function permanentely (until you switch to something else) just run ez-pz-log with the function you want as the only parameter:
```javascript
import log from '@pwntheon/ez-pz-log';
log(console.error);
try {
    foo.bar();
} catch(ex) {
    log("foo", "function bar threw exception:", ex.message);
}
```

You can also use a custom function just once by providing it as the first argument:
```javascript
import log from '@pwntheon/ez-pz-log';
try {
    foo.bar();
} catch(ex) {
    log(console.error, "foo", "function bar threw exception:", ex.message);
}
```

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