Creating application Logs

Last edit: Jul 09, 2019
  • Contributors:
  • pavelloz

This guide will help you create your own logs using the log Liquid tag. This tag allows you to print any information to application logs as type info, debug, error, or your own type, and list them in your console next to your sync.

You can use the log tag in any file that accepts Liquid, so you can use them in pages, layouts, partials, Authorization Policies, async callbacks, etc.


So that you can follow the steps in this tutorial, you have to have the pos-cli installed, an environment configured, and the codebase set up. You should be familiar with Pages, and the technologies behind platformOS, especially Liquid.


Creating your own application logs is a two-step process:

Step 1: Use log Liquid tag

Create a page using the log Liquid tag, and sync it.

slug: log-test
{% log 'This is a message' %}
{% log params, type: 'request-params' %}
{% log, type: 'debug' %}


You can print any object to the logs that can be printed.
You can use parameters (e.g. take parameters from the URL and include them in the message).
The type of the log entry can be any string you want to tag your entry.
If you chose error pos-cli will mark it red and try to notify your OS.

Step 2: Start logging

In your command line, enter the command to start live logging:

pos-cli logs staging

This pulls the logs from the server every couple of seconds and displays them in your command line.


We are always happy to help with any questions you may have.