How to write to log/trace a variable or put a comment in log file

I im trying to make a calculation based on the xiaomi cube and reporting setting eg. light and sound levels based on this.

I having some problems and feel I fumbeling in the dark, I know the logger function, but isn’t there a way to trace og log comment or variables in Home assistant to the log file?

I’m also looking for a way to write to the standard log file. Did you figure it out?