Endpoint and Code Loggers
The Endpoint Logger and Code Logger functions are symmetric.
That is, if you understand how one works, you can understand how the other works.
The common syntax for wrapper functions is :
@wrapper(wrapper_params)
def your_function(your_params):
<your code>
The common syntax for Endpoint and Code loggers is :
@logger(logger_params)
def your_function(ioc_logger, more_ioc_params, your_params):
<your code>
There are 3 parts to understanding this :
@logger(logger_params)
Replace logger with log_endpoint or log_codepoint as per the usage. This tells the logger the type of log.
logger_params refers to the parameters you want to log. You can input values here when you know the parameter value before-hand. For ex. Endpoint ID is a parameter value which can be defined as you would know the value prior to calling the endpoint function.
ioc_logger parameter in your_function
If you are logging a function, be it endpoint or code, the first parameter that it accepts should be a variable whose name remains constant across all your functions. Please note that this variable name should not conflict with any other variables you create. We recommend using ioc_logger as it is short, descriptive and would probably not conflict with any of your existing variables.
Note that you have to use this variable at both function definition and function call. (Tip : You can use a "replace across files" option in your editor to perform this more easily)
(Also, if you are extremely clear with how our code works, you can use different names for the above variable at different function definitions, calls and still make everything work. But its messy and you will not gain anything out of the experience except maybe a headache. Our recommended approach is smooth and is highly important in making your data powerfully relational.)
more_ioc_params parameters in your_function
If you know your log parameters during function definition, you can use Part 1. to log them.
If you will know your log parameters only while calling the function, you can pass these directly as function parameters will calling the function. Note that we will automatically pick it up from the parameter values and remove it from your **kwargs list so that your operations don't get affected.
Note that for the endpoint logger, you can also pass constant parameters in more_ioc_params. We have provided this option to include parameters like Customer_ID.
Email: insightsoncode@gmail.com