logondemand

package module
v0.0.0-...-3c5fdba Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 4 Imported by: 1

README

logondemand

log on demand for Go.

Example

client:

filename := "logondemand_test"
l, err := logondemand.New(filename)
if err != nil {
    log.Fatalf("New error: %v", err)
}
logger := log.New(l, "", log.Flags()|log.Lshortfile|log.Lmicroseconds)
for {
    logger.Printf("123")
    time.Sleep(1 * time.Second)
}

watch:

filename := "logondemand_test"
err := logondemand.Cat(filename)
if err != nil {
    log.Fatalf("Cat error: %v", err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cat

func Cat(filename string) error

Cat cat fifo content like shell `cat`. Restart after io.EOF.

func New

func New(filename string) (io.WriteCloser, error)

New create fifo if nessesary, which can be used in `log.New()`

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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