8a4da542ae
* Add GCP logging extender * Minor version bump for new API * Update packages/logger/src/logger.ts Co-Authored-By: kylecarbs <kyle@kwc.io> |
||
---|---|---|
.. | ||
src | ||
.npmignore | ||
README.md | ||
package.json | ||
tsconfig.build.json | ||
webpack.config.js | ||
yarn.lock |
README.md
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
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();