I am assuming that you are providing a negative value as input to log function in your code. If you supply a value less than zero to a log function, you will get a complex number. Simulink might be complaining about that in your code inside the function block.
You can limit the value of the output or input as shown below to avoid the error
logvalue = min(log(X),eps)
If above is not the case, providing your Simulink model or the code inside function block might be helpful