Format Error Message for Google Error Reporting

format_error_message(
  message = "Error description",
  service = "My Service",
  version = "0.0.1",
  method = "GET",
  url = "https://example.com",
  user_agent = "",
  referrer = "",
  response_status_code = "500",
  remote_ip = "192.178.0.0.1",
  user_id = "UserID",
  filepath = "/",
  line_number = 0,
  function_name = "my_function"
)

Arguments

message

the error message you want in the logs

service

the name of your service

version

the version of the service

method

the http method used for hte call

url

hte unique resource identifier that was called

user_agent

the user agente identifier

referrer

the referrer to the service

response_status_code

http response code

remote_ip

remote ip

user_id

user id

filepath

filepath of the code where the error originates

line_number

line number where the error originates

function_name

function name where the error originates

Value

message object, a list to be formated as JSON in the error report body