Task: Implement Logging Entry Functionality in Logrus
Implement the functionality for the Entry struct used in the Logrus logging library, ensuring it supports the operations outlined in the following test cases:
Error Handling with WithError:
Implement the WithError method on the Entry struct that:
Adds the error to the entry's Data field under the default key (which should be "error") and under a customizable key (which can be altered via a global variable).
Context Handling with WithContext:
Create the WithContext method that associates a context with the entry and stores it in the Context field of the Entry.
Panic Handling with Panicln and Panicf:
Implement both Panicln and Panicf methods for the Entry struct:
Panicln should log the message and the data, then trigger a panic with an Entry containing the message and any additional fields.
Panicf should format the log message and trigger a panic in the same way.
Hook Handling with Panic:
Implement support for hooks in the Entry that gracefully handle panics. If a hook results in a panic, it should recover and log the panic message.
Field Validation with WithFields:
Modify the WithFields method to validate that any fields being added are not functions or function pointers and ensure that appropriate error messages are created in these cases.
Log Level Filtering with Logf:
Implement the Logf method such that it respects the logger's level:
Messages below the logger's level should not be written to the output.
Be sure to handle all edge cases and ensure that the implementation aligns with the expected behavior as defined in the test cases provided. Place the implementation in the /app/ directory of your Go project.
Important: declare your solution in package logrus (the test file uses package logrus, so the implementation must use the matching package name).