mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-21 01:01:41 +00:00
Bootup sprint (#18)
* Did some stuff * Fix gradle, start implementing mjpeg frame consumer * Did some stuff * bade changes * rename camera config to USBCameraConfiguration, add name * unrename cameraconfiguration * Add pub/sub framework * Add setResolution to mjpeg frame consumer * add NTDataConsumer * Add some totally broken hsv hacks * Start refactoring UI data * Update index.js * Commit and push, he says * Fix up some errors * Fix input tab * Fix fps * Update index.js * Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables * Change v-model to point to data() * update hsv to use mutations * Work on saving, fix hsv * Rename shouldErode/shouldDilate to erode and dilate * Hook all the tabs up to the Store * Change handleData to handlePipelineData * camera quirk redo, add ICCSub to SocketHandler * Fix some property names * Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums * change pipeline type to an int in store * Fix mutation naming * Attempt threshold fix * Update SocketHandler.java * Add truthy data sending * Start adding logging support * [UI] Add delay to slider input boxes (#1) * [UI] [Backend] potentially fix camera settings, various logging tweaks * Don't release raw input mat * add setVideoModeIndex to vision settables * Implement pipeline index in socket handler, add framework for renaming/changing pipes * (ish) get pipeline change working * Create index.html * Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused) * Refactor UI to use mutatePipeline, send pipeline results * Update NetworkConfig.java * Change double to number * Run spotless * Fix reversal of large/small comparators * Fix left/right * Fix pitch/yaw calculation bug, fix area bug * Use Vue.set instead of assignment This fixes {{ }} * Update App.vue * run spotless * Actually add pipelines and reassign indecies * Delete old pipeline configs Fixes duplication on renaming pipeline * Start working on deleting pipes * Fix camera nickname change * run spotless * Fix some test stuff * Update VisionModuleManagerTest.java * vision source manager test is still broken * Fix VisionSourceManager test * Apply spotless 2 electric boogaloo Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com> Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com> Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
This commit is contained in:
@@ -21,5 +21,6 @@ public enum LogGroup {
|
||||
Camera,
|
||||
Server,
|
||||
VisionProcess,
|
||||
Data,
|
||||
General
|
||||
}
|
||||
|
||||
@@ -27,11 +27,12 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.photonvision.common.dataflow.DataChangeService;
|
||||
import org.photonvision.common.dataflow.events.OutgoingUIEvent;
|
||||
import org.photonvision.server.UIUpdateType;
|
||||
|
||||
public class Logger {
|
||||
|
||||
private final String className;
|
||||
|
||||
public static final String ANSI_RESET = "\u001B[0m";
|
||||
public static final String ANSI_BLACK = "\u001B[30m";
|
||||
public static final String ANSI_RED = "\u001B[31m";
|
||||
@@ -42,7 +43,10 @@ public class Logger {
|
||||
public static final String ANSI_CYAN = "\u001B[36m";
|
||||
public static final String ANSI_WHITE = "\u001B[37m";
|
||||
|
||||
private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private static final SimpleDateFormat simpleDateFormat =
|
||||
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private final String className;
|
||||
private final LogGroup group;
|
||||
|
||||
public Logger(Class<?> clazz, LogGroup group) {
|
||||
@@ -50,6 +54,11 @@ public class Logger {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public Logger(Class<?> clazz, String suffix, LogGroup group) {
|
||||
this.className = clazz.getSimpleName() + " - " + suffix;
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public static String getDate() {
|
||||
return simpleDateFormat.format(new Date());
|
||||
}
|
||||
@@ -81,11 +90,13 @@ public class Logger {
|
||||
levelMap.put(LogGroup.Camera, Level.INFO);
|
||||
levelMap.put(LogGroup.General, Level.INFO);
|
||||
levelMap.put(LogGroup.Server, Level.INFO);
|
||||
levelMap.put(LogGroup.Data, Level.INFO);
|
||||
levelMap.put(LogGroup.VisionProcess, Level.INFO);
|
||||
}
|
||||
|
||||
static {
|
||||
currentAppenders.add(new ConsoleAppender());
|
||||
currentAppenders.add(new UILogAppender());
|
||||
}
|
||||
|
||||
public static void addFileAppender(Path logFilePath) {
|
||||
@@ -113,7 +124,7 @@ public class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean shouldLog(Level logLevel, LogGroup group) {
|
||||
public static boolean shouldLog(Level logLevel, LogGroup group) {
|
||||
return logLevel.code <= levelMap.get(group).code;
|
||||
}
|
||||
|
||||
@@ -152,8 +163,18 @@ public class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
private static class UILogAppender extends Appender {
|
||||
@Override
|
||||
void log(String message) {
|
||||
var message_ = new HashMap<>();
|
||||
message_.put("logMessage", message);
|
||||
DataChangeService.getInstance()
|
||||
.publishEvent(new OutgoingUIEvent<>(UIUpdateType.BROADCAST, "log", message_));
|
||||
}
|
||||
}
|
||||
|
||||
private static class AsyncFileAppender extends Appender {
|
||||
private Path filePath;
|
||||
private final Path filePath;
|
||||
|
||||
public AsyncFileAppender(Path logFilePath) {
|
||||
this.filePath = logFilePath;
|
||||
|
||||
Reference in New Issue
Block a user