gclog/entry

Types and methods to construct an Entry.

Types

A fairly complete Google Cloud Logging Entry.

pub type Entry {
  Entry(
    severity: Severity,
    message: json.Json,
    labels: Option(Dict(String, String)),
    trace: Option(Trace),
    span_id: Option(String),
    trace_sampled: Option(Bool),
    source_location: Option(SourceLocation),
  )
}

Constructors

  • Entry(
      severity: Severity,
      message: json.Json,
      labels: Option(Dict(String, String)),
      trace: Option(Trace),
      span_id: Option(String),
      trace_sampled: Option(Bool),
      source_location: Option(SourceLocation),
    )

Represents a location in source code.

pub type SourceLocation {
  SourceLocation(
    file: Option(String),
    line: Option(Int),
    function: Option(String),
  )
}

Constructors

  • SourceLocation(
      file: Option(String),
      line: Option(Int),
      function: Option(String),
    )

Validate traces. Ensures the project id and trace id are provided.

pub type Trace {
  Trace(project: String, id: String)
}

Constructors

  • Trace(project: String, id: String)

Functions

pub fn new(severity: Severity, message: Json) -> Entry

Create a new, minimal log Entry.

pub fn with_labels(
  entry: Entry,
  labels: Dict(String, String),
) -> Entry

Add labels to an existing Entry.

pub fn with_source_location(
  entry: Entry,
  line lineno: Int,
  file fileloc: String,
  function func: String,
) -> Entry

Add where the log was called from to an existing Entry.

pub fn with_span_id(entry: Entry, span_id: String) -> Entry

Add a span id to an existing Entry.

pub fn with_trace(entry: Entry, trace: Trace) -> Entry

Add a trace to an existing Entry.

pub fn with_trace_sampled(
  entry: Entry,
  trace_sampled: Bool,
) -> Entry

Specify the trace sampled field for an existing Entry.

Search Document