-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logkitten improvements #216
base: main
Are you sure you want to change the base?
Conversation
LogKitten.java
Outdated
switch(i.getValue()) { | ||
case "RobotModeKitten": | ||
if(getRobotMode() == ((RobotModeKitten)i.getKey()).getMode()) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of duplicate code between "RobotModeKitten" and "CANKitten" cases. The code:
try {
if(i.getKey().output != null) {
i.getKey().output.write(content.getBytes());
} else {
System.out.println("Error logging: " + i.getKey().category + " logfile not open");
}
}
catch(IOException ioe) {
System.out.println("Error logging " + level.getName() + " message");
ioe.printStackTrace();
}
Could probably be reduced to a private method, or maybe a better flow could be worked out here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it might be better instead to move the logMessage
method to the Kitten
class itself, and have LogKitten
extend Kitten
or something of that sort. Looking at a screen is making me nauseous right now but I can take a closer look tomorrow hopefully.
…eam4904/standard into logkitten-improvements
…standard into logkitten-improvements
changed it from "edu.wpi.first.wpilibj.hal.HAL;" to "edu.wpi.first.hal.HAL;"
Added an instantiable class to LogKitten called Kitten. Kitten can in turn be extended and logged using LogKitten to be able to classify certain errors and log them in different files. Already created and integrated classes include CANKitten for logging CAN errors and messages and RobotKitten for logging based on which robot mode. Global logging is coded into the LogKitten class. MAKE SURE YOU REVIEW THE 2018 CODE PULL REQUEST AS WELL! This new code depends on it.