# Io Reference

Server / Syslog / Syslog

|  | Provides access to a Unix system's system logger.
    logger = Syslog clone do(
    	identity("SyslogTest")
    	facility(facilityMap at("LOG_USER"))
    	options(List append(optionsMap at("LOG_PID"), optionsMap at("LOG_CONS")))
    	priority(priorityMap at("LOG_INFO"))
    	open(facility, options)
    	mask(List append(maskMap at("LOG_PRIMASK")))
    	log(priority, "*** Merely a test ***")
    	close
    )
Note: This is partially tested. Please let me know of any problems you happen to stumble across, or if it could be better. --Jeremy Tregunna
|  | close Closes a log that has previously been opened for writing. facility(optionalFacility) Specifies the logging facility, which can be one of any of the values found in the facilityMap map. If optionalFacility is omitted, returns the currently set facility. facilityMap Contains the following keys, which represent numbers that can be used when opening a log: LOG_KERN LOG_USER LOG_MAIL LOG_DAEMON LOG_AUTH LOG_SYSLOG LOG_LPR LOG_NEWS LOG_UUCP LOG_CRON LOG_AUTHPRIV LOG_FTP LOG_RESERVED0 LOG_RESERVED1 LOG_RESERVED2 LOG_RESERVED3 LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 identity(optionalIdentity) If optionalIdentity is specified, provides an identity for all of the messages you will be sending to the syslog daemon. Returns the identity. isOpen Returns self if the log is opened for writing. Otherwise, returns Nil. log Writes the supplied data to the log. Requires 2 arguments: Logging Priority Message to log mask(optionalMask) If optionalMask is specified, optionalMask is a list which contains any one or more values stored in the maskMap hash that will be OR'd together, to provide the proper mask. Returns the logging mask (as a List). maskMap Contains keys/value pairs which represent numbers that specify the logging mask. These values may be any one (or more) of the following: LOG_PRIMASK LOG_FACMASK open(aPriority, someOptions, optionalIdentity) Opens the syslog for writing. optionalIdentity need not be entered and will default to the name of the distribution of Io you are running or if you have embedded Io into your application and set Lobby distribution = "foo", it will be set to "foo". options(optionalOptions) If optionalOptions is specified, it should represent a list of the logging options you can find in the optionsMap slot. All the values in the supplied aList will be OR'd together when you call the open or reopen slots. Returns the list of options if optionalFacility is omitted. optionsMap A map containing key/value pairs holding all available options. These include: LOG_PID LOG_CONS LOG_ODELAY LOG_NDELAY LOG_NOWAIT LOG_PERROR priority(optionalPriority) If optionalPriority is specified, sets the value, and returns it. If no value is specified, will return the previously stored value if one has been set previously. priorityMap Contains key/value pairs for logging priorities for use when calling the log() method. These include: LOG_EMERG LOG_ALERT LOG_CRIT LOG_ERR LOG_WARNING LOG_NOTICE LOG_INFO LOG_DEBUG reopen(aFacility, someOptions, optionalIdentity) Reopens an already open log session. This is useful if you wish to change the facility you are logging to, the options you are logging with, or the identity of the session. Takes the same options as the open slot.