blob: 4d8eeffa0f8bd3193ec8b16efb6f87242c5506b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright 2024 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
import (
golanglog "log"
"os"
)
// start writing all the logging to a tmp file
func SetTmpOLD() {
f, err := os.OpenFile("/tmp/guilogfile", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
realFatalf("error opening file: %v", err)
}
// hmm. is there a trick here or must this be in main()
// defer f.Close()
golanglog.SetOutput(f)
realPrintln("This is a test log entry")
}
// start writing all the logging to a tmp file
func UnsetTmp() {
golanglog.SetOutput(os.Stdout)
realPrintln("This is a test log entry")
}
|