API Endpoint
  • API: https://lighthouse-api.itpathsolutions.com/add-log
  • Type: POST
  • Form Data: Check the form data details below.
Form Data
  • vp : Project key (required).
  • vd : Deliverable key (required).
  • o : Log type id (required). The value can be 1 for debug, 2 for warning, 3 for notice, 4 for info, 5 for error.
  • r : IP address (required).
  • a : JSON String of the Log Data. In PHP you can do json_encode(LOG_DATA). Check LOG_DATA for detail.
LOG_DATA

Log Data is an array. In log data array the information about error data, request data, tags details, additional data, etc. Check the below format.

  • b : Array of the error data. Check ERROR_DATA
  • i : You can pass the additional data in array format.
  • j : Tags in array format. Check TAGS_DATA
  • k : Request header data in array format. Check REQUEST_HEADER_DATA
  • l : Request body data in array format. Check REQUEST_BODY_DATA
  • m : Request page URL
  • n : Request method type (GET, POST, etc).
ERROR_DATA

Array of the error trace data. This contains the lines of the error.

  • c : Error message
  • d : Error file
  • f : Error Line No
  • g : Error Code
  • h : Error Exception Class
TAGS_DATA

Tags data can be passed in the array format. For example:

['platform' => 'PHP','version' => '8.0']
REQUEST_HEADER_DATA

You need to pass the array of the headers. For example:

[
  "host" => [
    0 => "127.0.0.1:8000"
  ]
]
REQUEST_BODY_DATA

You need to pass the array of the body. For example:

[
  "name" => "John",
  "order_id" => "1",
  "product_ids" => ["1", "2", "3"]
]
Example
$LOG_DATA = [
    "b" => [
        "c" => "Division by zero",
        "d" => "C:\Bitnami\wampstack-8.0.14-0\apache2\htdocs\dhruv\laravel-
vue\app\Http\Controllers\TestController.php",
        "e" => [],
        "f" => 20,
        "g" => 0,
        "h" => "DivisionByZeroError",
    ],
    "i" => [
        "user_data" => [
            "name" => "John",
            "id" => 1,
        ],
        "order_data" => [
            "order_id" => "001",
        ],
    ],
    "j" => [
        "browser-name" => "Google Chrome",
        "browser-version" => "100.0.4896.75",
        "os" => "windows",
        "logger" => "php",
        "php-version" => "8.0.14",
    ],
    "m" => "http://127.0.0.1:8000/api/test/addLog",
    "n" => "GET",
];

$payload = [
    'vp' => 'p0001',
    'vd' => 'd0001',
    'o' => 1,
    'a' => json_encode($LOG_DATA),
    'r' => '0.0.0.0',
];


$ch = curl_init('http://192.168.1.152/lighthouseLumen/public/add-log');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);