Skip to content

Commit

Permalink
Fix the logging example so that it is valid JS
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Maj authored and filmaj committed Oct 20, 2021
1 parent bfe7fe6 commit fc2c737
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions docs/_advanced/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ order: 8
---

<div class="section-content">
By default, Bolt for JavaScript will log information from your app to the console. You can customize how much logging occurs by passing a `logLevel` in the constructor. The available log levels in order of most to least logs are `DEBUG`, `INFO`, `WARN`, and `ERROR`.
By default, Bolt for JavaScript will log information from your app to the console. You can customize how much logging occurs by passing a `logLevel` in the constructor. The available log levels in order of most to least logs are `DEBUG`, `INFO`, `WARN`, and `ERROR`.
</div>

```javascript
Expand Down Expand Up @@ -52,14 +52,15 @@ const app = new App({
signingSecret,
// Creating a logger as a literal object. It's more likely that you'd create a class.
logger: {
debug(...msgs): { logWritable.write('debug: ' + JSON.stringify(msgs)); },
info(...msgs): { logWritable.write('info: ' + JSON.stringify(msgs)); },
warn(...msgs): { logWritable.write('warn: ' + JSON.stringify(msgs)); },
error(...msgs): { logWritable.write('error: ' + JSON.stringify(msgs)); },
setLevel(): { },
setName(): { },
debug: (...msgs) => { logWritable.write('debug: ' + JSON.stringify(msgs)); },
info: (...msgs) => { logWritable.write('info: ' + JSON.stringify(msgs)); },
warn: (...msgs) => { logWritable.write('warn: ' + JSON.stringify(msgs)); },
error: (...msgs) => { logWritable.write('error: ' + JSON.stringify(msgs)); },
setLevel: (level) => { },
getLevel: () => { },
setName: (name) => { },
},
});
```

</details>
</details>

0 comments on commit fc2c737

Please sign in to comment.