mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 00:12:25 -05:00 
			
		
		
		
	Add optional syslog logrus hook (#343)
* add optional syslog logrus hook * document syslog
This commit is contained in:
		
					parent
					
						
							
								909f801742
							
						
					
				
			
			
				commit
				
					
						c111b239f7
					
				
			
		
					 38 changed files with 2242 additions and 37 deletions
				
			
		
							
								
								
									
										35
									
								
								vendor/gopkg.in/mcuadros/go-syslog.v2/handler.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								vendor/gopkg.in/mcuadros/go-syslog.v2/handler.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| package syslog | ||||
| 
 | ||||
| import ( | ||||
| 	"gopkg.in/mcuadros/go-syslog.v2/format" | ||||
| ) | ||||
| 
 | ||||
| //The handler receive every syslog entry at Handle method | ||||
| type Handler interface { | ||||
| 	Handle(format.LogParts, int64, error) | ||||
| } | ||||
| 
 | ||||
| type LogPartsChannel chan format.LogParts | ||||
| 
 | ||||
| //The ChannelHandler will send all the syslog entries into the given channel | ||||
| type ChannelHandler struct { | ||||
| 	channel LogPartsChannel | ||||
| } | ||||
| 
 | ||||
| //NewChannelHandler returns a new ChannelHandler | ||||
| func NewChannelHandler(channel LogPartsChannel) *ChannelHandler { | ||||
| 	handler := new(ChannelHandler) | ||||
| 	handler.SetChannel(channel) | ||||
| 
 | ||||
| 	return handler | ||||
| } | ||||
| 
 | ||||
| //The channel to be used | ||||
| func (h *ChannelHandler) SetChannel(channel LogPartsChannel) { | ||||
| 	h.channel = channel | ||||
| } | ||||
| 
 | ||||
| //Syslog entry receiver | ||||
| func (h *ChannelHandler) Handle(logParts format.LogParts, messageLength int64, err error) { | ||||
| 	h.channel <- logParts | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue