Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add docs about raw method #271

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -225,6 +225,18 @@ Log types are exposed as `consola.[type](...)` and each is a preset of styles an

A list of all available built-in types is [available here](./src/constants.ts).

## Raw output

Objects sent to reporter by logging them could be an issue when using conflicting key (esp. `args`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to add a link to isLogObj function, or add more description about conflicting keys, because conflicting keys are not so many, just a few.

Or, we could cover it in examples, as #271 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea to add a link to the isLogObj and we could add a note that this is an advanced feature.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this is what i am saying in comment bellow haha, to not go too deep, non of these internals are supposed to be documented as stable feature to use, nor are guaranteed to stay as is, that's why initially not documented ;)

To enforce the object to be fully threaded with conflict, you can use the `raw` method chained to any log type.
edimitchel marked this conversation as resolved.
Show resolved Hide resolved

```js
consola.log({ args: ['foo']});
// returns foo
consola.log.raw({ args: ['foo']});
// returns { args: [ 'foo' ] }
```

## Creating a new instance

Consola has a global instance and is recommended to use everywhere.
Expand Down