discord test stars

About

The syslog package in the Mys programming language.

Project: https://github.com/mys-lang/package-syslog

Example

Generate a syslog message.

from syslog import SYSLOG
from syslog import LEVEL_WARNING

func main():
    SYSLOG(LEVEL_WARNING, "A message.")

The output on a Ubuntu machine:

 mys run
 Reading package configuration (0 seconds)
 Building (1.05 seconds)
 tail -1 /var/log/syslog
Jul 21 07:57:04 erik-GR8 app: A message.

API

class SyslogHandler(Handler):
    Writes log messages to the system log.

    func write(self, message: string):
        Writes given log message to the system log.
func openlog(ident: string, option: i64, facility: i64):
    Opens a connection to the system logger for a program.
macro SYSLOG(priority: i64, message: string):
    Generates a log message.
func closelog():
    Closes the file descriptor being used to write to the system
    logger.
func setlogmask(mask: i64) -> i64:
    Sets the logmask for the calling process, and returns the previous
    mask.  If the mask argument is 0, the current logmask is not
    modified.
func log_upto(level: i64) -> i64:
    Calculates the mask for all levels up to and including given level.
LEVEL_EMERG: i64
LEVEL_ALERT: i64
LEVEL_CRIT: i64
LEVEL_ERR: i64
LEVEL_WARNING: i64
LEVEL_NOTICE: i64
LEVEL_INFO: i64
LEVEL_DEBUG: i64
FACILITY_KERN: i64
FACILITY_USER: i64
FACILITY_MAIL: i64
FACILITY_DAEMON: i64
FACILITY_AUTH: i64
FACILITY_LPR: i64
FACILITY_NEWS: i64
FACILITY_UUCP: i64
FACILITY_CRON: i64
FACILITY_SYSLOG: i64
FACILITY_LOCAL0: i64
FACILITY_LOCAL1: i64
FACILITY_LOCAL2: i64
FACILITY_LOCAL3: i64
FACILITY_LOCAL4: i64
FACILITY_LOCAL5: i64
FACILITY_LOCAL6: i64
FACILITY_LOCAL7: i64
FACILITY_AUTHPRIV: i64
OPTION_PID: i64
OPTION_CONS: i64
OPTION_NDELAY: i64
OPTION_PERROR: i64