1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-29 05:35:25 +00:00
code-server-2/packages/logger/README.md

33 lines
720 B
Markdown
Raw Normal View History

2019-01-08 00:46:19 +00:00
# Logger
Beautiful logging inspired by https://github.com/uber-go/zap.
- Built for node and the browser
- Zero dependencies
- Uses groups in the browser to reduce clutter
2019-01-08 00:46:19 +00:00
## Example Usage
```javascript
import { field, logger } from "@coder/logger";
logger.info("Loading container",
field("container_id", container.id_str),
field("organization_id", organization.id_str));
```
## Formatting
By default the logger uses a different formatter depending on whether it detects
it is running in the browser or not. A custom formatter can be set:
```javascript
import { logger, Formatter } from "@coder/logger";
class MyFormatter extends Formatter {
// implementation ...
}
logger.formatter = new MyFormatter();
```