v1.2.0 整个beegolog 打进去, 增加syncmap日志通道
This commit is contained in:
		
							parent
							
								
									ed9201b453
								
							
						
					
					
						commit
						7cb5ecc181
					
				
							
								
								
									
										3
									
								
								log.go
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								log.go
									
									
									
									
									
								
							@ -75,7 +75,6 @@ func GetLogger(name string) *Logger {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		wd, _ := os.Getwd()
 | 
			
		||||
		fmt.Println(wd)
 | 
			
		||||
 | 
			
		||||
		conf1 := FileLogConfig{
 | 
			
		||||
			Filename: path.Join(wd, fmt.Sprintf("runtime/logs/%s.log", name)),
 | 
			
		||||
@ -94,7 +93,7 @@ func GetLogger(name string) *Logger {
 | 
			
		||||
		confString, _ := json.Marshal(&conf1)
 | 
			
		||||
		confString2, _ := json.Marshal(&conf2)
 | 
			
		||||
		l := new(Logger)
 | 
			
		||||
		l.BeeLogger = logs.NewLogger()
 | 
			
		||||
		l.BeeLogger = logs.NewLogger(1000)
 | 
			
		||||
		l.SetLogger(logs.AdapterFile, bytes.NewBuffer(confString).String())
 | 
			
		||||
		l.SetLogger(logs.AdapterConsole, bytes.NewBuffer(confString2).String())
 | 
			
		||||
		l.BeeLogger.SetPrefix("_" + name)
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,8 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestGetLogger(t *testing.T) {
 | 
			
		||||
	GetLogger("nds").Debug("我正在调试")
 | 
			
		||||
	GetLogger("nds").Critical("出错了")
 | 
			
		||||
	l := GetLogger("nds")
 | 
			
		||||
	l.Debug("我正在调试")
 | 
			
		||||
	l.Critical("出错了")
 | 
			
		||||
	GetLogger("wifi").Critical("hello wifi")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user