Skip to content

Commit

Permalink
Fix logging levels
Browse files Browse the repository at this point in the history
  • Loading branch information
Matevz Morato committed Oct 18, 2023
1 parent 71a8deb commit c925824
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/device/DataQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ DataOutputQueue::DataOutputQueue(const std::shared_ptr<XLinkConnection> conn, co
std::vector<std::uint8_t> metadata;
DatatypeEnum type;
msg->getRaw()->serialize(metadata, type);
spdlog::trace("Received message from device ({}) - parsing time: {}, data size: {}, object type: {} object data: {}",
logger::trace("Received message from device ({}) - parsing time: {}, data size: {}, object type: {} object data: {}",
name,
std::chrono::duration_cast<std::chrono::microseconds>(t2Parse - t1Parse),
msg->data->getSize(),
Expand Down Expand Up @@ -202,7 +202,7 @@ DataInputQueue::DataInputQueue(

// Log
if(spdlog::get_level() == spdlog::level::trace) {
spdlog::trace("Sent message to device ({}) - data size: {}, metadata: {}, sending time: {}",
logger::trace("Sent message to device ({}) - data size: {}, metadata: {}, sending time: {}",
stream.getStreamName(),
outgoing.data->getSize(),
spdlog::to_hex(outgoing.metadata),
Expand Down
13 changes: 7 additions & 6 deletions src/device/DeviceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ void DeviceBase::init2(Config cfg, const dai::Path& pathToMvcmd, tl::optional<co
std::unique_lock<std::mutex> lock(pimpl->rpcMutex);

// Log the request data
if(logger::get_level() == spdlog::level::trace) {
if(getLogOutputLevel() == LogLevel::TRACE) {
pimpl->logger.trace("RPC: {}", nlohmann::json::from_msgpack(request).dump());
}

Expand Down Expand Up @@ -1402,11 +1402,12 @@ bool DeviceBase::startPipelineImpl(const Pipeline& pipeline) {
std::vector<std::uint8_t> assetStorage;
pipeline.serialize(schema, assets, assetStorage);

// if debug
if(logger::get_level() <= spdlog::level::debug) {
auto pipelineSer = pipeline.serializeToJson();
pimpl->logger.debug("Schema dump: {}", pipelineSer["pipeline"].dump());
pimpl->logger.debug("Asset map dump: {}", pipelineSer["assets"].dump());
// if debug or lower
if(getLogOutputLevel() <= LogLevel::DEBUG) {
nlohmann::json jSchema = schema;
pimpl->logger.debug("Schema dump: {}", jSchema.dump());
nlohmann::json jAssets = assets;
pimpl->logger.debug("Asset map dump: {}", jAssets.dump());
}

// Load pipelineDesc, assets, and asset storage
Expand Down

0 comments on commit c925824

Please sign in to comment.