Skip to content

Commit

Permalink
Merge pull request #167 from lora-aprs/logger_update
Browse files Browse the repository at this point in the history
send syslog message on connect
  • Loading branch information
peterus authored Mar 20, 2022
2 parents dc34f3b + 66a72fa commit 149e222
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/LoRa_APRS_iGate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,14 @@ void setup() {
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "setup done...");
}

volatile bool syslogSet = false;

void loop() {
LoRaSystem.getTaskManager().loop(LoRaSystem);
if (LoRaSystem.isWifiEthConnected()) {
if (LoRaSystem.getUserConfig()->syslog.active) {
LoRaSystem.getLogger().setSyslogServer(LoRaSystem.getUserConfig()->syslog.server, LoRaSystem.getUserConfig()->syslog.port, LoRaSystem.getUserConfig()->callsign);
}
if (LoRaSystem.isWifiEthConnected() && LoRaSystem.getUserConfig()->syslog.active && !syslogSet) {
LoRaSystem.getLogger().setSyslogServer(LoRaSystem.getUserConfig()->syslog.server, LoRaSystem.getUserConfig()->syslog.port, LoRaSystem.getUserConfig()->callsign);
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "System connected after a restart to the network, syslog server set");
syslogSet = true;
}
}

Expand Down

0 comments on commit 149e222

Please sign in to comment.