예제 #1
0
파일: syslog.go 프로젝트: streadway/gobark
// Single threaded
func Syslog(ident string, priority syslog.Priority, message string) {
	// (re)open the log
	if ident != syslogIdent {
		if syslogIdent != "" {
			C.closelog()
		}

		C.openlog(C.CString(ident), LOG_NDELAY, LOG_LOCAL1)
		syslogIdent = ident
	}

	s := C.CString(message)
	C._syslog(C.int(priority), s)
	C.free(unsafe.Pointer(s))
}
예제 #2
0
파일: syslog.go 프로젝트: john-cai/tools
// Closes the current Syslog connection, if there is one.
// This includes closing the /dev/log socket, if it is open.
// Closelog also sets the identification string for Syslog messages back to the default,
func Closelog() {
	C.closelog()
}