Commit 8c530bec authored by ChaiShushan's avatar ChaiShushan Committed by Andrew Gerrand

log: add example

Fixes #6028.

R=golang-dev, bradfitz, adg, r
CC=golang-dev
https://golang.org/cl/43320043
parent 6801c014
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package log_test
import (
"bytes"
"fmt"
"log"
)
func ExampleLogger() {
var buf bytes.Buffer
logger := log.New(&buf, "logger: ", log.Lshortfile)
logger.Print("Hello, log file!")
fmt.Print(&buf)
// Output:
// logger: example_test.go:15: Hello, log file!
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment