Skip to content

WebAssembly/wasi-logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WASI Logging

A proposed WebAssembly System Interface API.

Current Phase

WASI-logging is currently in Phase 1.

Champions

  • Dan Gohman

Phase 4 Advancement Criteria

The Phase 4 Adancement Criteria for this API are not yet defined.

Table of Contents

Introduction

WASI Logging is a WASI API for emitting log messages.

Goals

The primary goal of WASI logging is to be a simple logging API usable as a stderr destination in commands and as a logging output in headless programs.

Non-goals

WASI Logging is not aiming to be a general-purpose output stream, with support for error reporting or asynchronous operation.

API walk-through

There are two main use cases.

Logging use case

The logging API can be used to log simple messages:

   log(Level::Info, "fyi", "The program is running");

Stderr use case

The logging API can be used as an output for a command-style stderr.

   log(Level::Info, "stderr", "Message printed to stderr in a command");

Detailed design discussion

What levels should there be?

The log levels are similar to those of log4j, the Rust log crate, the Python log levels, the Ruby log levels, the .NET log levels, the Go zap library log levels, and the Go zerolog library levels.

Another similar API is the POSIX syslog function. LOG_EMERG and LOG_ALERT have no corresponding levels, because WASI programs don't have visibility into how their own errors affect "the system" as a whole. A Critical level should be used instead, optionally with a trap if it's desirable to halt execution. Similarly, LOG_NOTICE and LOG_INFO both correspond to Info, because most of the popular systems don't make a distinction between these levels.

What should the context be?

Currently the context parameter is an uninterpreted string, because it's the simplest thing that works for now. It may evolve into something else though.

Stakeholder Interest & Feedback

TODO before entering Phase 3.

References & acknowledgements

Many thanks for valuable feedback and advice from:

  • Luke Wagner

Releases

No releases published

Packages

No packages published