Ejemplo n.º 1
0
// 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))
}
Ejemplo n.º 2
0
// 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()
}