Skip to content

Add some docs about how to use scopeΒ #51

@mattwynne

Description

@mattwynne

Hey, thanks for this little gem of a library πŸ‘ πŸŽ‰

I was trying to figure out how to replace the default zoya scope in the log messages, and here's what I came up with:

const logger = zoya({
  fields: [scope({ scopes: ['main'] }), separator(), badge(), label(), separator(), message(), context()],
})

Is this the right way to do it? I figured this out by reading the tests (which were very easy to read πŸ‘ ) but I'm not sure if I've missed something:

  • why is scopes an array? What happens if I define multiple scopes?
  • can I specify the scope when logging a message? If so, how?

I guess some more examples might be useful. The santa one is cute but not very illustrative :)

If you prefer to just explain to me here in the issue how to use it, I can send a PR with an update to the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions