ltsvlog

package module
v0.0.0-...-1296b55 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2017 License: BSD-3-Clause Imports: 8 Imported by: 0

README

ltsvlog

Warning Under developing. API will be changed in further commits.

Examples

with struct
package main

import . "github.com/harukasan/ltsvlog"

type L struct{
  Time time.Time
  Status int
  URL string
}

func main() {
  Log(L{Time: time.Now, Status: 200, URL: "https://example.com/"})
  // time:1970-01-01T09:00:00+09:00\tstatus:200\turl:https://example.com/
}
with fields
package main

import . "github.com/harukasan/ltsvlog"

func main() {
  Logf(F("time", time.Now), F("status", 200), F("url", "https://example.com/"))
  // time:1970-01-01T09:00:00+09:00\tstatus:200\turl:https://example.com/
}

Copyright 2017 Shunsuke Michii. All rights reserverd. See LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = &Logger{
	w: os.Stdout,
}

Functions

func Log

func Log(v interface{})

func Logf

func Logf(fields ...Field)

func SetOutput

func SetOutput(w io.Writer)

Types

type Field

type Field struct {
	Key   string
	Value interface{}
}

func F

func F(key string, value interface{}) Field

type Logger

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

func (*Logger) Log

func (l *Logger) Log(v interface{})

func (*Logger) Logf

func (l *Logger) Logf(fields ...Field)

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer)

Jump to

Keyboard shortcuts

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