Skip to content

Commit

Permalink
logging fixes, moved include, formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
neilstephens committed Jul 26, 2024
1 parent a7f0188 commit decfe9b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions Code/Ports/FileTransferPort/FileTransferPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include "FileTransferPort.h"
#include "FileTransferPortConf.h"
#include <opendatacon/util.h>
#include <filesystem>
#include <memory>
Expand Down Expand Up @@ -1080,19 +1081,19 @@ void FileTransferPort::TrySend(const std::string& path, std::string tx_name)
fin.open(path, std::ios::binary);
if (fin.fail())
{
if(auto log = odc::spdlog_get("FileTransferPort"))
if(auto log = odc::spdlog_get("FileTransferPort"))
log->error("{}: Failed to open file path for reading: '{}'",Name,path);
tx_in_progress = false;
tx_filename_q.erase(path);
if(!tx_filename_q.empty())
{
pSyncStrand->post([this,h{handler_tracker},next{*tx_filename_q.begin()}]
tx_in_progress = false;
tx_filename_q.erase(path);
if(!tx_filename_q.empty())
{
pSyncStrand->post([this,h{handler_tracker},next{*tx_filename_q.begin()}]
{
auto& [next_path,next_tx_name] = next;
TrySend(next_path, next_tx_name);
});
}
return;
return;
}
SendChunk(path,std::chrono::high_resolution_clock::now());
}));
Expand Down Expand Up @@ -1230,7 +1231,8 @@ std::pair<bool,std::string> FileTransferPort::FileNameTransmissionMatch(const st
if(std::regex_match(filename, match_results, *pConf->pFilenameRegex))
{
if(match_results.size() > pConf->FileNameTransmissionMatchGroup)
return {true,match_results.str(pConf->FileNameTransmissionMatchGroup)};
return {true,match_results.str(pConf->FileNameTransmissionMatchGroup)}
;
return {true,filename};
}
return {false,""};
Expand Down
1 change: 0 additions & 1 deletion Code/Ports/FileTransferPort/FileTransferPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#ifndef FileTransferPort_H_
#define FileTransferPort_H_
#include "FileTransferPortConf.h"
#include <opendatacon/DataPort.h>
#include <filesystem>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion Code/Ports/LuaPort/LuaPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void LuaPort::Build()
//only called on Lua sync strand
void LuaPort::Event_(std::shared_ptr<const EventInfo> event, const std::string& SenderName, SharedStatusCallback_t pStatusCallback)
{
if(auto log = spdlog::get("LuaPort"))
if(auto log = odc::spdlog_get("LuaPort"))
log->trace("{}: {} event from {}", Name, ToString(event->GetEventType()), SenderName);

//Get ready to call the lua function
Expand Down
3 changes: 2 additions & 1 deletion Code/Ports/PortTemplate/PORT_TYPE_TEMPLATEPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "<PORT_TYPE_TEMPLATE>Port.h"
#include <opendatacon/util.h>
#include <opendatacon/spdlog.h>

<PORT_TYPE_TEMPLATE>Port::<PORT_TYPE_TEMPLATE>Port(const std::string& aName, const std::string& aConfFilename, const Json::Value& aConfOverrides):
DataPort(aName, aConfFilename, aConfOverrides)
Expand All @@ -45,7 +46,7 @@ void <PORT_TYPE_TEMPLATE>Port::Build()
}
void <PORT_TYPE_TEMPLATE>Port::Event(std::shared_ptr<const EventInfo> event, const std::string& SenderName, SharedStatusCallback_t pStatusCallback)
{
if(auto log = spdlog::get("<PORT_TYPE_TEMPLATE>Port"))
if(auto log = odc::spdlog_get("<PORT_TYPE_TEMPLATE>Port"))
log->trace("{}: {} event from {}", Name, ToString(event->GetEventType()), SenderName);

(*pStatusCallback)(CommandStatus::SUCCESS);
Expand Down

0 comments on commit decfe9b

Please sign in to comment.