Creating Logs page [closed]

1

I created a usr_logs table in my database with the following columns:

  • id
  • email
  • ip
  • time
  • date
  • sucess

Only those records are sufficient, or do I need to add something else?

How do I display all the data entered in this table?

    
asked by anonymous 02.07.2014 / 05:02

2 answers

3

The fields you are going to put in is optional and depends on what exactly you want to store, but I believe that the main field is missing to tell you what happened (a message in the log to identify what that record is about, you just identify that something happened). Depending on the type of log you could have one more field to know what type of log (WARNING, ERROR, NOTICE or others that you come to assign), if you deem it necessary to still put the class name, method name or function, filename and line number this would help at the time of debugging and you could release different views of this table using view, so it would be possible for you to have a complete table to debug and show a simpler one for someone just being able to keep track of what happened and if there was error or not, could even add the user who was using the application when the error occurred, code version. To display the inserted data is simple simply connect to the database and extract the data on screen. I strongly advise you to use jQuery.DataTables for ease of implementation, documentation, and functionality, if you are viewing this data on the web, if it is desktop application you can use a Data Grid present in the programming language.

In this link you will find a complete example of implementing the datatable with php the usage is very simple to use you will need the plugin of datatable and jquery, if you wish you can still apply the boostraps on it. There are other ways this is just one of them.

Some fields that can be added (all this is optional and goes according to the need of each)

  • classname
  • methodname
  • functionname
  • line
  • filename
  • message
  • review
  • user_id
  • type
04.07.2014 / 14:14
1

Although the answer from @Sileno Brito is very cool, I'm a fan of the Monolog component where you can report email , ip , sucess as part of context and datetime is already generated by the same component, and then store the output in the format that you think is best.

At each log recording, you will enter the log type (WARNING, ERROR, NOTICE ...)

    
04.07.2014 / 15:15