Skip to content

Users dont log. Should we do some logging by default #64

@WillMunns

Description

@WillMunns

In the arena we publish the logs from each of the teams, but often we see that people do not actually write any logging.

This is a suggestion for how we might improve logging for all users.

I suggest that every time that some setting is made that the Robot lib writes to the log to show this change. Thus a write to

servo[1]=100

Should by default output "INFO: Servo 1 Set to 100 \r\n"

There are two obvious issues with this:

while atest:  
    servo[1] = 100  
    atest .....  
servo[1] = 0  

Would cause a million messages at line speed, which we want to avoid, however setting the servo to the same value might well be a bug which we do want to call out, so I think that we should report a small number of repeat settings before explicitly call out the suppression. This is like syslog behaviour, except that syslog is only updated once the messages have been repeat suppressed and we can't do that because out logs are being read out live

So I suggest we output

INFO: Servo [1] Set to 100
INFO: Servo [1] Set to 100 (without being set to an intermediate value)
INFO: Servo [1] Set to 100 (without being set to an intermediate value 2)
INFO: Suppressing repeated messages for Servo [1]
INFO: Servo [1] set to new value after 1367214 repeat requests
INFO: Servo [1] Set to 0

The second issue is that users may not want this behaviour, we could add a global enable/disable feature that can be set from the robot object initialisation and/or later using function calls.

One thing we might want to work around is that it would be nice if we could make the hardware shim not depend on known state, especially if there is any chance that the hardware state might be modified behind the back of the user python. We could do this by reading state and modifying if required rather than writing blindly as we do now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions