File: log.go

package info (click to toggle)
golang-github-glendc-go-external-ip 0.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 144 kB
  • sloc: sh: 11; makefile: 3
file content (18 lines) | stat: -rw-r--r-- 332 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package externalip

import (
	"io"
	"io/ioutil"
	"log"
)

// NewLogger returns a new standard logger, with a given writer.
// if w is <nil>, all logs will be discarded.
func NewLogger(w io.Writer) *log.Logger {
	if w == nil {
		w = ioutil.Discard
	}

	return log.New(w, "",
		log.Ldate|log.Ltime|log.Lmicroseconds|log.Lshortfile)
}