native_syslog.cpp 783 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright Andrey Semashev 2016.
  3. * Distributed under the Boost Software License, Version 1.0.
  4. * (See accompanying file LICENSE_1_0.txt or copy at
  5. * http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #include <syslog.h>
  8. int main(int, char*[])
  9. {
  10. ::openlog("test", LOG_NDELAY, LOG_USER);
  11. ::syslog(LOG_USER | LOG_DEBUG, "debug message");
  12. ::syslog(LOG_USER | LOG_INFO, "info message");
  13. ::syslog(LOG_USER | LOG_NOTICE, "notice message");
  14. ::syslog(LOG_USER | LOG_WARNING, "warning message");
  15. ::syslog(LOG_USER | LOG_ERR, "error message");
  16. ::syslog(LOG_USER | LOG_CRIT, "critical message");
  17. ::syslog(LOG_USER | LOG_ALERT, "alert message");
  18. ::syslog(LOG_USER | LOG_EMERG, "emergency message");
  19. ::closelog();
  20. return 0;
  21. }