Back

Display Function Logs in Reverse Chronological Order (Latest to Oldest)

  • 3
  • General
  • Functions
  • Web
  • Cloud
Ranga Reddy
9 Jun, 2023, 07:41

Is there a way to display function logs in reverse chronological order (latest to oldest) for a better user experience? It would be beneficial as it allows users to easily track and analyse the most recent events, helping with debugging and troubleshooting. is there any possibility for this? Thank you.

TL;DR
Is there a way to display function logs in reverse chronological order? Yes, there is. You can use the JavaScript code provided below: ```javascript const sortedFunctions= [Array Of Function Executions].sort((a, b) => b.[executionTimeStamp].toLocaleString().localeCompare(a.[executionTimeStamp].toLocaleString())); //store `sortedFunctions` and display. ``` This code will sort the array of function executions in reverse chronological order based on the execution timestamp. Storing the sorted array will allow you to display it in the desired order.
Sandeep K. Dasari
9 Jun, 2023, 07:59

Yeah there is a way.

Sandeep K. Dasari
9 Jun, 2023, 08:02
TypeScript
const sortedFunctions= [Array Of Function Executions].sort((a, b) => b.[executionTimeStamp].toLocaleString().localeCompare(a.[executionTimeStamp].toLocaleString())
    );
//store `sortedFunctions` and display.
Sandeep K. Dasari
9 Jun, 2023, 08:03

[Array Of Function Executions] = get an array of all executions.. in which [executionTimeStamp] is the timestamp of execution.

Sandeep K. Dasari
9 Jun, 2023, 08:05

Oh you are pointing out Appwrite Console?

Ranga Reddy
9 Jun, 2023, 08:05

Sorry, If I am not clear

Sandeep K. Dasari
9 Jun, 2023, 08:05

Okok

Sandeep K. Dasari
9 Jun, 2023, 08:06

I thought that you want , them in your app. to show them to users.

Sandeep K. Dasari
9 Jun, 2023, 08:06

Creat a GitHub issue for this.

Ranga Reddy
9 Jun, 2023, 08:06

No sandeep, I was looking for something in console

Sandeep K. Dasari
9 Jun, 2023, 08:07

right

Sandeep K. Dasari
9 Jun, 2023, 08:07

since, it's a done project, they can't do it immediately. but we can create a github issue.

Ranga Reddy
9 Jun, 2023, 08:07

If you dont mind can you specify the repo?

Sandeep K. Dasari
9 Jun, 2023, 08:09
Ranga Reddy
9 Jun, 2023, 08:12

Thanks @Sandeep K. Dasari

Binyamin
9 Jun, 2023, 12:39
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more