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
Functions
pub fn critical(logger: Logger(a, b), message: a) -> Nil
Log a message at the Critical 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 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.