github.com/mattn/go@v0.0.0-20171011075504-07f7db3ea99f/src/log/syslog/example_test.go (about) 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 // +build !windows,!nacl,!plan9 6 7 package syslog_test 8 9 import ( 10 "fmt" 11 "log" 12 "log/syslog" 13 ) 14 15 func ExampleDial() { 16 sysLog, err := syslog.Dial("tcp", "localhost:1234", 17 syslog.LOG_WARNING|syslog.LOG_DAEMON, "demotag") 18 if err != nil { 19 log.Fatal(err) 20 } 21 fmt.Fprintf(sysLog, "This is a daemon warning with demotag.") 22 sysLog.Emerg("And this is a daemon emergency with demotag.") 23 }