Skip to main content
Below are some of the most commonly used functions and data structures in qi.

File System

.qi.path

Build paths into `:path/to/file

.qi.spath

Similar to path but returns as "path/to/file"

.qi.ospath

The same as spath on Mac/Linux, different on Windows

.qi.exists

Returns a boolean indicating whether a file / folder exists

.qi.ensuredir

Creates a directory if it does not already exist

Event

.event.addhandler

Register a handler for an event

Cron (timer)

The cron library uses the event library to manage jobs that are to be run on a timer.

.cron.add

Schedule a timer job

.cron.jobs

Table of scheduled jobs

.cron.start

If the q timer (\t) is 0, set it to .conf.QTIMER.

Inter-process Communication (IPC)

.ipc.conn

Establish / retrieve a connection to a named process

.ipc.conns

Table of active connections and their metadata.

Log

error / warn / info / debug / trace

The log library has various print functions, in the following order of log level:
  1. .log.error
  2. .log.warn
  3. .log.info
  4. .log.debug
  5. .log.trace
These functions expect either plain text, or text and a dictionary:

.log.fatal

Calls .log.error before exiting the process.

.log.setlevel

Filters outputs at this level and below e.g.
Now only error, warn, and info messages will appear in the logs.

.log.setformat

Controls the output format of logs. The options are plain (default), logfmt and json.

.log.usefields

Use custom fields:
Fields in {} are calculated at log time.