Module system.log

The log module exposes functions for interacting with the logging subsystem. The default system log is available under the root log table. Other logs created through log.create can be accessed by indexing the log table with the name of the log, e.g. log.mylog.info("hello"). Both the main and subtables may also be called directly, e.g. log("test") or log.mylog("hello").

Index

Data

levels

Constants for log levels.

warn

Function

close()

Closes a log or stream for listening.

create()

Creates a new log.

critical()

Writes a critical error message to the log.

debug()

Writes a debug message to the log.

error()

Writes an error message to the log.

info()

Writes an info message to the log.

notice()

Writes a notice message to the log.

open()

Opens a log for listening to messages.

remove()

Removes a previously created log.

setTTY()

Sets the TTY to output a log to. (Requires root)

traceback()

Writes a traceback error message to the log.

warning()

Writes a warning message to the log.

Class

log

Writes a message to the log.

API Reference

class system.log.log

Writes a message to the log.

for the syslog syscall for more information.

strings with \t.

staticmethod log(options?: table, ...: any): unknown

Writes a message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

staticmethod debug(options?: table, ...: any): unknown

Writes a debug message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

staticmethod info(options?: table, ...: any): unknown

Writes an info message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

staticmethod notice(options?: table, ...: any): unknown

Writes a notice message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

staticmethod warning(options?: table, ...: any): unknown

Writes a warning message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

warn: function
staticmethod error(options?: table, ...: any): unknown

Writes an error message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

staticmethod critical(options?: table, ...: any): unknown

Writes a critical error message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

staticmethod traceback(message?: string): unknown

Writes a traceback error message to the log.

Parameters:

message? (string) – A message to attach to the traceback

system.log.debug(options?: table, ...: any): unknown

Writes a debug message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

system.log.info(options?: table, ...: any): unknown

Writes an info message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

system.log.notice(options?: table, ...: any): unknown

Writes a notice message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

system.log.warning(options?: table, ...: any): unknown

Writes a warning message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

system.log.warn: function
system.log.error(options?: table, ...: any): unknown

Writes an error message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

system.log.critical(options?: table, ...: any): unknown

Writes a critical error message to the log.

for the syslog syscall for more information.

strings with \t.

Parameters:
  • options? (table) – A table of options to supply. See the documentation

  • ... (any) – The values to print to the log, which will be concatenated as

system.log.traceback(message?: string): unknown

Writes a traceback error message to the log.

Parameters:

message? (string) – A message to attach to the traceback

system.log.levels: table

Constants for log levels.

system.log.create(name: string, streamed?: boolean, file?: string): (result: table)

Creates a new log.

Parameters:
  • name (string) – The name of the log to create

  • streamed? (boolean) – Whether to make the log available for streaming

  • file? (string) – The path to the file to write the log to

Returns:

result (table) – A logger object from log.*

system.log.remove(name: string): unknown

Removes a previously created log.

Parameters:

name (string) – The log to remove

system.log.open(name: string, filter?: string): (result: number)

Opens a log for listening to messages.

openlog syscall docs for more info)

Parameters:
  • name (string) – The name of the log to listen to

  • filter? (string) – A filter command to filter messages with (see the

Returns:

result (number) – An ID to identify the logged messages with

system.log.close(name: string | number): unknown

Closes a log or stream for listening.

ID returned by log.open.

Parameters:

name (string | number) – The log name to close (closes all streams), or an

system.log.setTTY(name: string, tty: TTY | nil, level?: number): unknown

Sets the TTY to output a log to. (Requires root)

Parameters:
  • name (string) – The log to set the TTY of

  • tty (TTY | nil) – The TTY to use, or nil to disable

  • level? (number) – The minimum log level to show messages