/****************************************************************************** * FunctionName : syslog_add_entry * Description : add a syslog_entry_t to the syslogQueue * Parameters : entry: the syslog_entry_t * Returns : none ******************************************************************************/ static void ICACHE_FLASH_ATTR syslog_add_entry(syslog_entry_t *entry) { syslog_entry_t *pse = syslogQueue; DBG("[%dµs] %s id=%lu\n", WDEV_NOW(), __FUNCTION__, entry->msgid); // append msg to syslog_queue if (pse == NULL) syslogQueue = entry; else { while (pse->next != NULL) pse = pse->next; pse->next = entry; // append msg to syslog queue } // Debug: show queue addr, current msgid, avail. heap and syslog datagram // DBG("%p %lu %d %s\n", entry, entry->msgid, system_get_free_heap_size(), entry->datagram); // ensure we have sufficient heap for the rest of the system if (system_get_free_heap_size() < syslogHost.min_heap_size) { if (syslogState != SYSLOG_HALTED) { // os_printf("syslog_add_entry: Warning: queue filled up (%d), halted\n", system_get_free_heap_size()); entry->next = syslog_compose(SYSLOG_FAC_USER, SYSLOG_PRIO_CRIT, "SYSLOG", "queue filled up (%d), halted", system_get_free_heap_size()); os_printf("%s\n", entry->next->datagram); if (syslogState == SYSLOG_READY) syslog_send_udp(); syslog_set_status(SYSLOG_HALTED); } } }
/****************************************************************************** * FunctionName : syslog_add_entry * Description : add a syslog_entry_t to the syslogQueue * Parameters : entry: the syslog_entry_t * Returns : none ******************************************************************************/ static void ICACHE_FLASH_ATTR syslog_add_entry(syslog_entry_t *entry) { syslog_entry_t *pse = syslogQueue; // append msg to syslog_queue if (pse == NULL) syslogQueue = entry; else { while (pse->next != NULL) pse = pse->next; pse->next = entry; // append msg to syslog queue } // ensure we have sufficient heap for the rest of the system if (system_get_free_heap_size() < syslogHost.min_heap_size) { if (syslogState != SYSLOG_HALTED) { os_printf("syslog_add_entry: Warning: queue filled up, halted\n"); entry->next = syslog_compose(SYSLOG_FAC_SYSLOG, SYSLOG_PRIO_CRIT, "-", "queue filled up, halted"); if (syslogState == SYSLOG_READY) syslog_send_udp(); syslogState = SYSLOG_HALTED; } } }