gclog

Simple Google Cloud Platform compliant logging library.

Types

Type used to write logs. Any log messages written using the Logger must be serializable using the provided Serializer.

Examples

let logger = gclog.new_stderr(severity.Debug, json.string)

logger
|> gclog.info("Hello, world!")
pub type Logger(t, w) {
  Logger(
    severity: Severity,
    writer: Writer(w),
    serializer: Serializer(t),
  )
}

Constructors

  • Logger(
      severity: Severity,
      writer: Writer(w),
      serializer: Serializer(t),
    )

Convert a type into JSON.

pub type Serializer(t) =
  fn(t) -> json.Json

Write a log.

pub type Writer(t) =
  fn(String) -> t

Functions

pub fn alert(logger: Logger(a, b), message: a) -> Nil

Log a message at the Alert level.

pub fn critical(logger: Logger(a, b), message: a) -> Nil

Log a message at the Critical level.

pub fn debug(logger: Logger(a, b), message: a) -> Nil

Log a message at the Debug level.

pub fn default(logger: Logger(a, b), message: a) -> Nil

Log a message at the Default level.

pub fn emergency(logger: Logger(a, b), message: a) -> Nil

Log a message at the Emergency level.

pub fn entry(logger: Logger(a, b), entry: Entry) -> Nil

Log a complete Entry.

pub fn error(logger: Logger(a, b), message: a) -> Nil

Log a message at the Error level.

pub fn info(logger: Logger(a, b), message: a) -> Nil

Log a message at the Info level.

pub fn log(
  logger: Logger(a, b),
  message: a,
  severity: Severity,
) -> Nil

Log a message specifying the severity manually.

pub fn new_stderr(
  severity: Severity,
  serializer: fn(a) -> Json,
) -> Logger(a, Nil)

Create a new logger that writes logs to stderr.

pub fn new_stdout(
  severity: Severity,
  serializer: fn(a) -> Json,
) -> Logger(a, Nil)

Create a new logger that writes logs to stdout.

pub fn notice(logger: Logger(a, b), message: a) -> Nil

Log a message at the Notice level.

pub fn warning(logger: Logger(a, b), message: a) -> Nil

Log a message at the Warning level.

Search Document