Skip to content

Commit

Permalink
logger(docs): include an example setup with some configurations (#1899)
Browse files Browse the repository at this point in the history
  • Loading branch information
zimeg authored Aug 23, 2024
1 parent f37115b commit e5a4f3f
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions packages/logger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,41 @@ mimics the default node `console` API with three additions:
- `setLevel(LogLevel)`: sets the `LogLevel` of the logger.
- `setName(string)`: sets a prefix to display in logs. Useful if you have multiple loggers active.

### Example

This short snippet shows various `Logger` levels and customized labels:

```javascript
const { ConsoleLogger, LogLevel } = require("@slack/logger");

const logger = new ConsoleLogger();

logger.error("a problem happened");
logger.warn("might need attention");
logger.info("take note of this");
logger.debug("or dig into details");

logger.setName("HAL");
logger.setLevel(LogLevel.DEBUG);

logger.info("what an observation");
logger.debug("i am so interested");
```

When run, messages that match the following values are logged:

```txt
[ERROR] a problem happened
[WARN] might need attention
[INFO] take note of this
[INFO] HAL what an observation
[DEBUG] HAL i am so interested
```

## Getting Help

If you get stuck, we're here to help. The following are the best ways to get assistance working through your issue:

* [Issue Tracker](http://github.com/slackapi/node-slack-sdk/issues) for questions, feature requests, bug reports and
general discussion related to this package. Try searching before you create a new issue.
* [Email us](mailto:[email protected]) in Slack developer support: `[email protected]`
- [Issue Tracker](http://github.com/slackapi/node-slack-sdk/issues) for questions, feature requests, bug reports and
general discussion related to this package. Try searching before you create a new issue.
- [Email us](mailto:[email protected]) in Slack developer support: `[email protected]`

0 comments on commit e5a4f3f

Please sign in to comment.