Skip to content

Commit

Permalink
vmpserverd: Add MicroHTTPKit logger and set GStreamer Debug Threshold…
Browse files Browse the repository at this point in the history
… based on config
  • Loading branch information
hmelder committed Mar 7, 2024
1 parent 47599cf commit f81092a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Daemons/vmpserverd/src/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <gst/gst.h>
#include <stdlib.h>

#import <MicroHTTPKit/MicroHTTPKit.h>

// Generated project configuration
#include "../build/config.h"

Expand Down Expand Up @@ -41,6 +43,12 @@ int main(int argc, char *argv[]) {
// Tap into the GStreamer logging system
gst_debug_add_log_function(VMPGStreamerLoggingBridge, NULL, NULL);

// Use the vmpserverd journal for MicroHTTPKit
HKDefaultConnectionLogger = ^(HKHTTPRequest *r) {
VMPInfo(@"%@ %@ -- Headers: %@; Query: %@", [r method], [r URL], [r headers],
[r queryParameters]);
};

@autoreleasepool {
NSRunLoop *runLoop;
NSString *selectedPath;
Expand Down Expand Up @@ -119,6 +127,9 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}

// Update the GStreamer debug threshhold and clear old overwrites
gst_debug_set_threshold_from_string([[configuration gstDebug] UTF8String], TRUE);

// Create server
VMPServerMain *server = [VMPServerMain serverWithConfiguration:configuration
forcePlatform:forcePlatform
Expand Down

0 comments on commit f81092a

Please sign in to comment.