Skip to content
/ intercom Public

A small logging package for use in Golang-based Concourse resource type implementations

Notifications You must be signed in to change notification settings

mdb/intercom

Repository files navigation

intercom

A small logging package for use in Golang-based Concourse resource type implementations.

Because Concourse resources communicate with Concourse over stdout, it's recommended that:

Resources can emit logs to the user by writing to stderr. ANSI escape codes (coloring, cursor movement, etc.) will be interpreted properly by the web UI, so you should make your output pretty.

intercom does just this and writes to stderr:

Example Get

Usage Example

logger := intercom.NewLogger("debug")

// prints red text
logger.Errorf("foo")

// prints yellow text
logger.Warnf("bar")

// prints green text
logger.Infof("baz")

// prints blue text
logger.Debugf("bim")

All methods ultimately use Fprintf, so you can also do things like...

// prints 'foo bar' in red text
logger.Errorf("foo %s", "bar")

Exposing log level configuration to users

By using intercom as a configurable logger, Concourse resource authors can expose log level configuration options to users, in effect giving resource users troubleshooting capabilities via a configurable source field:

resource_types:

- name: some-resource
  type: docker-image
  source:
    repository: owner/some-resource

resources:

- name: some-resource
  type: some-resource
  source:
    log_level: debug

About

A small logging package for use in Golang-based Concourse resource type implementations

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published