import { Steps, Tabs, Tab } from 'nextra-theme-docs'; ## lib.logger ```lua lib.logger(source, event, message, ...) ``` - source: `number` or `string` - Preferably an active player id, otherwise an identifier, or wherever else it originated from. - event: `string` - A name for the log event (i.e. the trigerring event or a description) - message: `string` - The content for the log. - ...: `string` - Additional arguments are converted to tags for additional filtering and searching. ### Example ```lua local vehicle = Ox.CreateVehicle(false, `sultanrs`, vector4(-56.479122, -1116.870362, 26.432250, 0.000030517578)) lib.logger(-1, 'CreateVehicle', json.encode(vehicle)) ``` ## Datadog ### Create your [Datadog](https://www.datadoghq.com/) account You will receive a free 14 day trial, otherwise refer to their [pricing](https://www.datadoghq.com/pricing/) guide. Free accounts are limited, however logs will still be retained for 14 days. ### Create an [API key](https://app.datadoghq.com/organization-settings/api-keys) This is a UUID used to submit logs to your Datadog organisation. ### Config Set your API key and [Datadog site](https://docs.datadoghq.com/getting_started/site/) using the following convars. ```bash set datadog:key "yourapikey" set datadog:site "datadoghq.com" ``` ## Grafana Loki Loki is a horizontally scalable, highly available, multi-tenant log aggregation system inspired by Prometheus. It is designed to be very cost effective and easy to operate. - Has free tier with some restrictions - Easy to manage - Easier to setup - Mostly managed by Grafana ### Create your [Grafana](https://grafana.com/) account ### Head to [My Account](https://grafana.com/auth/sign-in/?plcmt=top-nav&cta=myaccount) ### Setup Loki Find the Loki section in your account panel, and click "Details". Generate a password and save the API key, as well as your `user` and `url`. To setup a grafana instance you'll require docker, and knowledge on containers or kubernetes. Please find a guide to setup a grafana stack (min requirement grafana and grafana loki) and follow that. Once done, setup authentication and use the username and password securing your endpoint. - By default self-hosted loki instances do not provide any authentication layers and will require an external authentication layer such as NGINX basic auth or Cloudflare Access. ### Config Use the following convars to set your logging service, endpoint, and authentication details. ```bash set ox:logger "loki" set loki:user "" set loki:password "" set loki:endpoint "" ```