1 Star 0 Fork 1

常清静矣/golang-100

forked from 蓝桥云课/golang-100 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
049-genLogger.go 589 Bytes
一键复制 编辑 原始数据 按行查看 历史
konroyliu 提交于 2021-01-11 10:51 . golang-100 answer
package main
import (
"log"
"os"
)
func main() {
// You can create as many loggers you want using the log.New method
// Each logger can write logs in different targets, use different prefix
// and different settings
logger1 := log.New(os.Stdout, "logger1: ", log.LstdFlags)
logger2 := log.New(os.Stdout, "logger2: ", log.LstdFlags|log.Lmicroseconds)
logger1.Println("Message from logger1")
logger2.Println("Message from logger2")
// Output:
// logger1: 20xx/xx/xx xx:xx:xx Message from logger1
// logger2: 20xx/xx/xx xx:xx:xx 000000 Message from logger2
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/syongaaa/golang-100.git
git@gitee.com:syongaaa/golang-100.git
syongaaa
golang-100
golang-100
master

搜索帮助