Since I am new to the Python programming, I want to be able to see how some of the different methods and functions manipulate data at different parts of my code, so I want to be able to just add a simple debug command of "the value of x is", x. I have tried to add this command to my code but keep getting errors so I am not putting it in the right format and I can find no examples on the forum to help me with this.
And I cannot find much in the way of explanation of the idea of (fmt, *args, **kwargs)
Up until this point, I have just created a test file, cut and paste a particular function into the file, and add print commands to see the how the data or strings are manipulated at different stages of the function using the Python I have loaded locally on my computer. Now that I want to see how the Plex API pulls out elements from an html or xml pages, that is not as easy. I was just going to install lxml and use that with my locally installed Python. Would this be better?
I use the logging that is baked into Plex for plug-in development.
Within your plug-in __init__.py you can use the following logger to output to the %localappdata%\Plex Media Server\Logs\PMS Plugin Logs\com.plexapp.plugins..log
Thanks for the response. I was trying to use in in my servicecode.pys file. I tried it with the format you gave above and I get an error that the global name log is not defined. I thought that log() was a Plex API not a Python module. Do I need to load a library for it to work?
And what exactly does "logger levels" mean? Are you just referring to the header of the message in the log like debug, warning, etc
You need to use Log() not log(). Capital ‘L’. When logging from the ServiceCode.pys, you may have to check the com.plexapp.system.log rather than the plugin log, depending on how you’re calling the code.
That is exactly what it was. Capitalization. I had already seen that based on what it was doing and where it was in the process, I may have to pull up the system log instead of the channel log. Being able to see values will really help me, so thanks so much. (I am trying to figure out how to use the regex search and match function, which is sooo much fun).
BTW, MikeWhy, I think I will load the lxml at some point, just for playing with the Python coding concepts overall, but for right now, these debug lines will help me specifically with the Plex APIs.