saclogsend

package module
v0.0.0-...-d35bae1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2018 License: MIT Imports: 2 Imported by: 0

README

saclogsend

A wrapper around Go's syslog package for transmitting logs to a remote syslog server over UDP.

Used by the Go microservices of mailsac.com.

Usage

package main

import (
  "flag"

  "github.com/mailsac/saclogsend"
)

var syslogNet = flag.String("syslog", "127.0.0.1:514", "net location of a syslog server")

var slog *saclogsend.Slog

func main() {
  flag.Parse()
  var err error
  slog, err = saclogsend.New("inbound", *syslogNet)
  if err != nil {
    slog.Err("failed connecting to syslog, %s", err.Error())
  } else {
    slog.Info("syslog connected:" + *syslogNet)
  }
}

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Slog

type Slog struct {
	// contains filtered or unexported fields
}

Slog is a logger instance. All methods support Printf string replacement.

func New

func New(tag, remoteHost string) (logger *Slog, err error)

New creates a new logger and connects it to the remote host

func (*Slog) Err

func (slog *Slog) Err(message string, args ...interface{})

Err writes an error message to the syslog

func (*Slog) Info

func (slog *Slog) Info(message string, args ...interface{})

Info writes an informational message to the syslog

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL