import syslog # Without logoption try: syslog.openlog() syslog.syslog('This is a syslog test without "logopt(ion)" set') syslog.closelog() except TypeError as logopterr: print "Error during logging without logopt" print logopterr else: print "No errors while logging without logopt(ion)" # With 'logoption' try: syslog.openlog(logoption=syslog.LOG_PID) syslog.syslog('This is a syslog test with "logoption" set') syslog.closelog() except TypeError as logopterr: print "Error during logging with logoption" print logopterr else: print "No errors while logging with logoption" # With 'logopt' try: syslog.openlog(logopt=syslog.LOG_PID) syslog.syslog('This is a syslog test with "logopt" set') syslog.closelog() except TypeError as logopterr: print "Error during logging with logopt" print logopterr else: print "No errors while logging with logopt"