bengeisler / TcLog

Flexible logging functionality for TwinCAT 3.
MIT License
54 stars 10 forks source link

Add OnRaisedCondition to logger #25

Closed rruiter87 closed 3 months ago

rruiter87 commented 3 months ago

This would make TcLogTRIG obsolete and address #19.

rruiter87 commented 3 months ago

Strange. I tested this and it worked, but now it doesn't anymore :/.

rruiter87 commented 3 months ago

No, this doesn't work, of course.

When I tested it, I only used .OnRaisedCondition once. Then it works.

I still think it should be possible to make it work, but it is more complicated. Maybe by passing a pointer to a boolean to OnConditionRaised. Then you can use a dictionary kind to store {<pointer address>: <R_TRIG instance>} key value pairs.

If the pointer is called, it checks if the pointer address is already present in the pool. If it is, it calls the matching R_TRIG. If it is not, it creates a new R_TRIG instance.

bengeisler commented 3 months ago

This is a good suggestion. I'm a bit short on time right now, but it seems a feature worth investing 👍