588da0443c
- Use whateverEmitter.event for the onWhatever methods. - Add readonly to a bunch of things. - Remove some redundancy in types. - Move initializations out of the constructor and into the declarations where it was reasonable to do so. - Disable a few no-any violations. |
||
---|---|---|
.. | ||
src | ||
package.json | ||
README.md | ||
yarn.lock |
Logger
Beautiful client logging inspired by https://github.com/uber-go/zap.
Example Usage
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:
import { logger, Formatter } from "@coder/logger";
class MyFormatter extends Formatter {
// implementation ...
}
logger.formatter = new MyFormatter();