mirror of
				https://github.com/SourceFellows/gobuch.git
				synced 2025-11-04 07:36:19 +01:00 
			
		
		
		
	initial import
This commit is contained in:
		
							
								
								
									
										5
									
								
								microservices/logging/go.mod
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								microservices/logging/go.mod
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
module golang.source-fellows.com/samples/logging
 | 
			
		||||
 | 
			
		||||
go 1.13
 | 
			
		||||
 | 
			
		||||
require github.com/sirupsen/logrus v1.6.0
 | 
			
		||||
							
								
								
									
										12
									
								
								microservices/logging/go.sum
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								microservices/logging/go.sum
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 | 
			
		||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
			
		||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
 | 
			
		||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
			
		||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 | 
			
		||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
			
		||||
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
 | 
			
		||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
 | 
			
		||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
 | 
			
		||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
			
		||||
							
								
								
									
										21
									
								
								microservices/logging/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								microservices/logging/main.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	log "github.com/sirupsen/logrus"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	// zusätzliche Felder an log.Entry anhängen
 | 
			
		||||
	log.WithFields(log.Fields{
 | 
			
		||||
		"importId": "ka18s",
 | 
			
		||||
		"size":     10,
 | 
			
		||||
	}).Info("Starte den Import")
 | 
			
		||||
	// Wiederverwenden von log.Entry damit alle weiteren
 | 
			
		||||
	// Aufrufe ebenfalls Felder bekommen
 | 
			
		||||
	contextLogger := log.WithFields(log.Fields{
 | 
			
		||||
		"importId": "0815s",
 | 
			
		||||
		"other":    "Ich werde geloggt",
 | 
			
		||||
	})
 | 
			
		||||
	contextLogger.Info("I'll be logged with common and other field")
 | 
			
		||||
	contextLogger.Info("Me too")
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user