void RemoteSyslogChannel::log(const Message& msg) { Poco::FastMutex::ScopedLock lock(_mutex); if (!_open) open(); std::string m; m.reserve(1024); m += '<'; Poco::NumberFormatter::append(m, getPrio(msg) + _facility); m += '>'; if (_bsdFormat) { Poco::DateTimeFormatter::append(m, msg.getTime(), BSD_TIMEFORMAT); m += ' '; m += _host; } else { m += "1 "; // version Poco::DateTimeFormatter::append(m, msg.getTime(), SYSLOG_TIMEFORMAT); m += ' '; m += _host; m += ' '; m += _name; m += ' '; Poco::NumberFormatter::append(m, msg.getPid()); m += ' '; m += msg.getSource(); } m += ' '; m += msg.getText(); _socket.sendTo(m.data(), static_cast<int>(m.size()), _socketAddress); }
void RemoteSyslogChannel::log(const Message& msg) { if (!_open) open(); std::string m; m.reserve(1024); m += '<'; m += Poco::NumberFormatter::format(getPrio(msg) + _facility); m += '>'; if (_bsdFormat) { m += Poco::DateTimeFormatter::format(msg.getTime(), BSD_TIMEFORMAT); m += ' '; m += _host; } else { m += "1 "; // version m += Poco::DateTimeFormatter::format(msg.getTime(), SYSLOG_TIMEFORMAT); m += ' '; m += _host; m += ' '; m += _name; m += ' '; m += Poco::NumberFormatter::format(msg.getPid()); m += ' '; m += msg.getSource(); } m += ' '; m += msg.getText(); _socket.sendBytes(m.data(), (int) m.size()); }
std::string Song::getPriority(unsigned idx) const { assert(m_song); if (idx > 0) return ""; return boost::lexical_cast<std::string>(getPrio()); }
void ledseqStop(led_t led, const ledseq_t *sequence) { int prio = getPrio(sequence); if(prio<0) return; xSemaphoreTake(ledseqSem, portMAX_DELAY); state[led][prio] = LEDSEQ_STOP; //Stop the seq. updateActive(led); xSemaphoreGive(ledseqSem); //Run the next active sequence (if any...) runLedseq(timer[led]); }
void ledseqRun(led_t led, const ledseq_t *sequence) { int prio = getPrio(sequence); if(prio<0) return; xSemaphoreTake(ledseqSem, portMAX_DELAY); state[led][prio] = 0; //Reset the seq. to its first step updateActive(led); xSemaphoreGive(ledseqSem); //Run the first step if the new seq is the active sequence if(activeSeq[led] == prio) runLedseq(timer[led]); }
void SyslogChannel::log(const Message& msg) { if (!_open) open(); syslog(getPrio(msg), "%s", msg.getText().c_str()); }