Concepts

Logs

We log information about various operations in the plugin. For now we log proxy api requests/responses, and operations regarding Sessions and Carts.

Proxy API

The proxy operations are logged, by default, on all GET requests.

The logs are kept in log text files in the WordPress upload directory under the subfolder path admira-wp-plugin/logs. Each log file is created for a specific day, with the filename having the following format admira-proxy-{date}.log where the date is in the format Y-m-d. By default, the log files are kept for 30 days, after which the oldest one is deleted when a new log file is created. This duration can be changed in the plugin's Settings.

On a successful admira response during the Proxy API request handling, we log the request to admira and, optionally, the response from admira.

For the admira request's log, we log the following:

  • Method (GET, etc).
  • Route (requested admira api).
  • (Optionally) Headers. By default are not logged. Can be turned on via the constant ADMIRA_PROXY_LOG_HEADERS.
  • Body up to 2000 characters.

The admira response is logged only if the constant ADMIRA_PROXY_LOG_GET is defined and true, and we log the following:

  • Headers.
  • Body up to 2000 characters.

Sessions and Carts

The proxy operations for specific sessions, and also the cart ID is applicable, are logged in a specific Logs table. This table keeps timestamped entries of relevant actions, such as POST requests to the admira Proxy, always associated with a session token, with the possibility of associating a cart in requests applicable to carts (including cart creation). Each entry also contains a data column with relevant information of the particular operation.

When a session is created, during the authentication process of creating a new session token, it's inserted into the table. Any subsequent successful POST request to the admira Proxy will be inserted as another entry with its own data, such as route information and the json body sent to admira. If the request is related to a cart, such as cart creation or routes with the cart_id, the cart_id will also be associated with the log entry.

Logging API

A route is provided for external logging for a session (and optionally a cart). See Log API route.

Previous
Sessions
Next
Caches