1
0
mirror of https://github.com/coder/code-server.git synced 2024-12-05 07:13:06 +08:00
code-server/packages/logger
Kyle Carberry 8a4da542ae
Add GCP logging extender (#503)
* Add GCP logging extender

* Minor version bump for new API

* Update packages/logger/src/logger.ts

Co-Authored-By: kylecarbs <kyle@kwc.io>
2019-04-17 13:41:10 -05:00
..
src Add GCP logging extender (#503) 2019-04-17 13:41:10 -05:00
.npmignore Allow logger package to be publishable (#37) 2019-03-04 11:57:29 -06:00
package.json Add GCP logging extender (#503) 2019-04-17 13:41:10 -05:00
README.md Allow logger package to be publishable (#37) 2019-03-04 11:57:29 -06:00
tsconfig.build.json Allow logger package to be publishable (#37) 2019-03-04 11:57:29 -06:00
webpack.config.js Allow logger package to be publishable (#37) 2019-03-04 11:57:29 -06:00
yarn.lock not finished 2019-02-05 11:15:42 -06: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

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();