Creating Marketplace Kit Logs
This guide will help you create your own Marketplace Kit logs using the log
Liquid tag. This tag allows you to print any information to Marketplace Kit logs as type info, debug, or error, 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.
Requirements
So that you can follow the steps in this tutorial, you have to have the Marketplace Kit installed, an environment configured, and the codebase set up. You should be familiar with Pages, and the technologies behind platformOS, especially Liquid.
- Quickstart Guide or Get Started tutorials: help you get access to our platform, set up a site, install the Marketplace Kit, set up the required directory structure, and deploy to your site.
- Technologies
Steps
Creating your own Marketplace Kit 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 user.id, type: 'debug' %}
Notes:
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
marketplace-kit 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:
marketplace-kit logs staging
This pulls the logs from the server every couple of seconds and displays them in your command line.
Questions?
We are always happy to help with any questions you may have. Check out our Help page, or contact us.