log

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2019 License: MIT Imports: 5 Imported by: 0

README

FetchWeb Log

Go Report Card Go Doc GitHub release

Introduction

FetchWeb Log is a simple logging package written in Go with no dependencies outside of the Go standard library.

Setup Example

package main

import (
	"errors"
	"os"

	log "github.com/FetchWeb/Log"
)

// TestLog writes test logs to Stdout.
func main() {
	if err := log.Startup(true, os.Stdout); err != nil {
		panic(err)
	}

	log.Info("Test Info message")
	log.Infof("Test Infof %v", errors.New("message"))

	log.Error("Test Error message")
	log.Errorf("Test Errorf %v", errors.New("message"))

	log.Debug("Test Debug message")
	log.Debugf("Test Debugf %v", errors.New("message"))
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogDebug bool

LogDebug determins whether debug logs should be output or not.

View Source
var LogOutput *os.File

LogOutput is the file logs are written to.

Functions

func Debug

func Debug(message string)

Debug writes a debug log.

func Debugf

func Debugf(message string, args ...interface{})

Debugf writes a debug log with arguments.

func Error

func Error(message string)

Error writes an error log.

func Errorf

func Errorf(message string, args ...interface{})

Errorf writes an error log with arguments.

func Info

func Info(message string)

Info writes an info log.

func Infof

func Infof(message string, args ...interface{})

Infof writes an info log with arguments.

func Startup

func Startup(logDebug bool, logOutput *os.File) error

Startup initialises the package.

Types

type Data

type Data struct {
	Level   string
	Message string
}

Data holds the data output in a log message.

Jump to

Keyboard shortcuts

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