exp: github.com/cryptix/exp/wslog Index | Files

package wslog

import "github.com/cryptix/exp/wslog"

Package wslog implements a (github.com/op/go-logging).Backend and a (net/http).Handler

The Handler upgrades requests to websocket connections and registeres them with the backend.

The Backend copies log records to all registerd clients.


Package Files

backend.go conn.go

type WebsocketBackend Uses

type WebsocketBackend struct {
    // contains filtered or unexported fields

WebsocketBackend is a Hub-like Backend that copies log messages to listening connections

func NewBackend Uses

func NewBackend() *WebsocketBackend

NewBackend creates a new WebsocketBackend.

func (*WebsocketBackend) Log Uses

func (b *WebsocketBackend) Log(level logging.Level, calldepth int, rec *logging.Record) error

Log implements the logging.Backend interface. It broadcasts Records to the registerd connections

func (*WebsocketBackend) ServeHTTP Uses

func (b *WebsocketBackend) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements net/http.Handler. upgrades the request to a websocket connection if successfull, registers it with the backend

Package wslog imports 5 packages (graph). Updated 2019-09-14. Refresh now. Tools for package owners.