Skip to main content
Version: 1.0.0

Logging

Platformatic DB uses a low overhead logger named Pino to output structured log messages.

Logger output level

By default the logger output level is set to info, meaning that all log messages with a level of info or above will be output by the logger. See the Pino documentation for details on the supported log levels.

The logger output level can be overriden by adding a logger object to the server configuration settings group:

platformatic.db.json
{
"server": {
"logger": {
"level": "error"
},
...
},
...
}

Log formatting

If you run Platformatic DB in a terminal, where standard out (stdout) is a TTY:

  • pino-pretty is automatically used to pretty print the logs and make them easier to read during development.
  • The Platformatic logo is printed (if colors are supported in the terminal emulator)

Example:

$ npx platformatic db start




/////////////
///// /////
/// ///
/// ///
/// ///
&& /// /// &&
&&&&&& /// /// &&&&&&
&&&& /// /// &&&&
&&& /// /// &&&&&&&&&&&&
&&& /// /////// //// && &&&&&
&& /// /////////////// &&&
&&& /// /// &&&
&&& /// // &&
&&& /// &&
&&& /// &&&
&&&& /// &&&
&&&&& /// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
///
///
///
///
///
///


[11:20:33.466] INFO (337606): server listening
url: "http://127.0.0.1:3042"

If stdout is redirected to a non-TTY, the logo is not printed and the logs are formatted as newline-delimited JSON:

$ npx platformatic db start | head
{"level":30,"time":1665566628973,"pid":338365,"hostname":"darkav2","url":"http://127.0.0.1:3042","msg":"server listening"}