...

Source file src/log/syslog/example_test.go

Documentation: log/syslog

		 1  // Copyright 2016 The Go Authors. All rights reserved.
		 2  // Use of this source code is governed by a BSD-style
		 3  // license that can be found in the LICENSE file.
		 4  
		 5  //go:build !windows && !plan9
		 6  // +build !windows,!plan9
		 7  
		 8  package syslog_test
		 9  
		10  import (
		11  	"fmt"
		12  	"log"
		13  	"log/syslog"
		14  )
		15  
		16  func ExampleDial() {
		17  	sysLog, err := syslog.Dial("tcp", "localhost:1234",
		18  		syslog.LOG_WARNING|syslog.LOG_DAEMON, "demotag")
		19  	if err != nil {
		20  		log.Fatal(err)
		21  	}
		22  	fmt.Fprintf(sysLog, "This is a daemon warning with demotag.")
		23  	sysLog.Emerg("And this is a daemon emergency with demotag.")
		24  }
		25  

View as plain text