You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In building my next workflow, I've implemented the caching functionality of alfred-workflow; however, this also means that every time I run test code from Sublime that uses caching, all the data I'm printing for my benefit is trapped and clustered within every call that alfred-workflow makes to the cache. I love the robust logging of what's happing in the script, and it's great for debug another user's problems (open the log and send me the output), but I really need a way to shut off the console printing when I'm building.
I tried to comment out these lines in the @property logger(self) code:
However, this shut down all console printing (aside from direct print commands). So when an error would occur, it wouldn't print the full Python error report.
So, how can I tell alfred-workflow not to print its logs, but still ensure that Python is printing its logs to the console?
The text was updated successfully, but these errors were encountered:
I'm afraid I don't really understand exactly what you're trying to achieve. At any rate, you shouldn't be messing with the code in workflow.py to alter logging behaviour: that isn't how Python's logging library works.
If you want to reduce/turn off logging from a Workflow instance, do wf.logger.setLevel(logging.INFO) (or logging.WARNING/logging.ERROR etc.), or straight up delete the existing handlers and replace them with a NullHandler.
So, how can I tell alfred-workflow not to print its logs, but still ensure that Python is printing its logs to the console?
"Python" does not print logs to the console or anywhere else. Only configured loggers do. You should probably read the logging tutorial, but basically you want to configure your own logger instance (in an entirely different namespace) and use that while telling Workflow.logger to be quiet (as described above).
While I'm not entirely sure what the problem is, I strongly suspect it stems from a lack of familiarity with the logging library and not from anything that Alfred-Workflow should be doing differently (it restricts its own logging to the workflow namespace).
If you need any advice, feel free to ask me via a PM on the Alfred forum.
In building my next workflow, I've implemented the caching functionality of
alfred-workflow
; however, this also means that every time I run test code from Sublime that uses caching, all the data I'm printing for my benefit is trapped and clustered within every call thatalfred-workflow
makes to the cache. I love the robust logging of what's happing in the script, and it's great for debug another user's problems (open the log and send me the output), but I really need a way to shut off the console printing when I'm building.I tried to comment out these lines in the
@property logger(self)
code:However, this shut down all console printing (aside from direct
print
commands). So when an error would occur, it wouldn't print the full Python error report.So, how can I tell
alfred-workflow
not to print its logs, but still ensure that Python is printing its logs to the console?The text was updated successfully, but these errors were encountered: