Skip to content

Commit

Permalink
Merge branch 'feature/AddTimeServer_#20' into develop Closes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
F4FXL committed Mar 24, 2022
2 parents c1ea6fa + d5b7810 commit a1cca3f
Show file tree
Hide file tree
Showing 33 changed files with 2,740 additions and 372 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ Tests/dstargateway_tests
DGWRemoteControl/dgwremotecontrol
DGWVoiceTransmit/dgwvoicetransmit
DGWTextTransmit/dgwtexttransmit
DGWTimeServer/dgwtimeserver
26 changes: 25 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,30 @@
}
]
},
{
"name": "(gdb) dgwtimeserver",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/DGWTimeServer/dgwtimeserver",
"args": ["${workspaceFolder}/Sandbox/__timeserver_test.cfg"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Activer l'impression en mode Pretty pour gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Définir la version désassemblage sur Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) dgwvoicetransmit",
"type": "cppdbg",
Expand Down Expand Up @@ -111,7 +135,7 @@
"program": "${workspaceFolder}/Tests/dstargateway_tests",
"args": [ ],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"cwd": "${workspaceFolder}/Tests/",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
Expand Down
23 changes: 18 additions & 5 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
"USE_GPSD=1",
"all"
],
"group": {
"kind": "build",
"isDefault": true
},
"group": "build",
"problemMatcher": []
},
{
Expand Down Expand Up @@ -58,6 +55,19 @@
"group": "build",
"problemMatcher": []
},
{
"label": "Build DGWTimeServer",
"type": "shell",
"command": "make",
"args": [
"-j3",
"ENABLE_DEBUG=1",
"USE_GPSD=1",
"DGWTimeServer/dgwtimeserver"
],
"group": "build",
"problemMatcher": []
},
{
"label": "Build DGWVoiceTransmit",
"type": "shell",
Expand All @@ -81,7 +91,10 @@
"ENABLE_DEBUG=1",
"USE_GPSD=1"
],
"group": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
]
Expand Down
12 changes: 6 additions & 6 deletions BaseCommon/LogFileTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
#include <fstream>
#include <chrono>
#include <ctime>
#include <cassert>

#include "LogFileTarget.h"

#define LOG_FILE_ROOT "dstargateway"

CLogFileTarget::CLogFileTarget(LOG_SEVERITY logLevel, const std::string & dir, bool rotate) :
CLogFileTarget::CLogFileTarget(LOG_SEVERITY logLevel, const std::string & dir, const std::string& fileRoot, bool rotate) :
CLogTarget(logLevel),
m_dir(dir),
m_fileRoot(fileRoot),
m_rotate(rotate),
m_file(),
m_day(0)
{

assert(!fileRoot.empty());
}

CLogFileTarget::~CLogFileTarget()
Expand All @@ -53,7 +53,7 @@ void CLogFileTarget::printLogIntFixed(const std::string& msg)

std::string filename(m_dir);
if(filename[filename.length() - 1U] != '/') filename.push_back('/');
filename.append(LOG_FILE_ROOT).append(".log");
filename.append(m_fileRoot).append(".log");
m_file.open(filename, std::ios::app);

if(m_file.is_open()) {
Expand All @@ -80,7 +80,7 @@ void CLogFileTarget::printLogIntRotate(const std::string& msg)
if(filename[filename.length() - 1U] != '/') filename.push_back('/');
char buf[64];
std::strftime(buf, 42, "-%Y-%m-%d", now_tm);
filename.append(LOG_FILE_ROOT).append(buf).append(".log");
filename.append(m_fileRoot).append(buf).append(".log");
m_file.open(filename, std::ios::app);
if(!m_file.is_open()) {
std::cerr << "FAILED TO OPEN LOG FILE :" << filename;
Expand Down
3 changes: 2 additions & 1 deletion BaseCommon/LogFileTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class CLogFileTarget : public CLogTarget
{
public:
CLogFileTarget(LOG_SEVERITY logLevel, const std::string& directory, bool rotate);
CLogFileTarget(LOG_SEVERITY logLevel, const std::string& directory, const std::string& fileRoot, bool rotate);
~CLogFileTarget();

protected:
Expand All @@ -37,6 +37,7 @@ class CLogFileTarget : public CLogTarget
void printLogIntFixed(const std::string& msg);
std::string buildFileName();
std::string m_dir;
std::string m_fileRoot;
bool m_rotate;
std::fstream m_file;
int m_day;
Expand Down
Loading

0 comments on commit a1cca3f

Please sign in to comment.