...
Run Format

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  // +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  }
    24  

View as plain text