una_maquina 35 Posted May 25, 2021 Hi, I wanna intercept all the log messages from MethodProvider.log("message"); is there any listener I can use or something? Basically whenever I call MethodProvider.log("something") in a function, I want to also catch that message and give it to my onPaint() method. In essence, I don't want to hardcode and just want to use the data from MethodProvider.log to print it out with onPaint()... if that makes any sense
Hashtag 8939 Posted May 25, 2021 There isn't. You can write your own log method that does what you want and also calls MethodProvider.log. Then you'd replace all MethodProvider.logs with your custom log method.
Bonfire 334 Posted May 25, 2021 I'm asking the following question without looking at your code, so please keep that in mind. But if you're logging things in your code, can't you just replace those logs with something to modify your paint? If not replace, then simply add a line of code at logging point to modify your paint? Again, I'm not too sure what you're doing, so I may be incorrect, but it sounds like you're over-engineering this. It sounds like you're doing something, logging the action, then want to modify your paint with what is logged. But why not just do something and paint what action is being performed? Feel free to let me know where my assumptions may be wrong.
una_maquina 35 Author Posted May 26, 2021 18 hours ago, Hashtag said: There isn't. You can write your own log method that does what you want and also calls MethodProvider.log. Then you'd replace all MethodProvider.logs with your custom log method. Oh yeaah, I should've done that from the beginning so I could have options down the line; thanks for the idea, I'll see if I can replace everything with one click or something 16 hours ago, Bonfire said: I'm asking the following question without looking at your code, so please keep that in mind. But if you're logging things in your code, can't you just replace those logs with something to modify your paint? If not replace, then simply add a line of code at logging point to modify your paint? Again, I'm not too sure what you're doing, so I may be incorrect, but it sounds like you're over-engineering this. It sounds like you're doing something, logging the action, then want to modify your paint with what is logged. But why not just do something and paint what action is being performed? Feel free to let me know where my assumptions may be wrong. I basically have a lot of printing to console to see what's going on and so I could debug easier -- using MethodProvider#log method. Anyways, Hashtag gave me a great idea, I'll need to refactor my code now a bit
Recommended Posts
Archived
This topic is now archived and is closed to further replies.