LightHub
4.6.0
Open-source smart home controller firmware
Toggle main menu visibility
Loading...
Searching...
No Matches
streamlog.h
Go to the documentation of this file.
1
#pragma once
2
#include <Print.h>
3
#include <Stream.h>
4
#include <Arduino.h>
5
#include <HardwareSerial.h>
6
#include <inttypes.h>
7
8
#if defined (STM32)
9
#include <USBSerial.h>
10
#endif
11
12
#ifndef LOGBUFFER_SIZE
13
#define LOGBUFFER_SIZE 85
14
#endif
15
16
#ifdef SYSLOG_ENABLE
17
#include <Syslog.h>
18
#endif
19
20
extern
uint8_t
serialDebugLevel
;
21
extern
uint8_t
udpDebugLevel
;
22
23
24
#ifndef SerialPortType
25
#define SerialPortType Stream
26
#endif
27
28
#define LOG_TRACE 9
29
#define LOG_DEBUG 7
30
#define LOG_INFO 6
31
#define LOG_ERROR 3
32
33
#define traceSerial if (serialDebugLevel>=LOG_TRACE || udpDebugLevel>=LOG_TRACE) debugSerial
34
class
Streamlog
:
public
Print
35
{
36
public
:
37
#ifdef SYSLOG_ENABLE
38
Streamlog
(
SerialPortType
* _serialPort, uint8_t _severity =
LOG_DEBUG
, Syslog * _syslog = NULL, uint8_t _ledPattern = 0);
39
#else
40
Streamlog
(
SerialPortType
* _serialPort, uint8_t _severity =
LOG_DEBUG
, uint8_t _ledPattern = 0);
41
#endif
42
//void begin(unsigned long speed);
43
//void end() ;
44
45
int
available
(
void
);
46
int
peek
(
void
);
47
int
read
(
void
);
48
void
flush
(
void
);
49
size_t
write
(uint8_t ch);
50
using
Print::write;
// pull in write(str) and write(buf, size) from Print
51
operator
bool() {
return
true
;};
52
private
:
53
uint8_t severity;
54
SerialPortType
*serialPort;
55
uint8_t ledPattern;
56
#ifdef SYSLOG_ENABLE
57
Syslog * syslog;
58
#endif
59
};
Streamlog::peek
int peek(void)
Definition
streamlog.cpp:55
Streamlog::write
size_t write(uint8_t ch)
Definition
streamlog.cpp:74
Streamlog::Streamlog
Streamlog(SerialPortType *_serialPort, uint8_t _severity=LOG_DEBUG, uint8_t _ledPattern=0)
Definition
streamlog.cpp:30
Streamlog::read
int read(void)
Definition
streamlog.cpp:61
Streamlog::available
int available(void)
Definition
streamlog.cpp:49
Streamlog::flush
void flush(void)
Definition
streamlog.cpp:68
serialDebugLevel
uint8_t serialDebugLevel
Definition
streamlog.cpp:12
udpDebugLevel
uint8_t udpDebugLevel
Definition
streamlog.cpp:13
LOG_DEBUG
#define LOG_DEBUG
Definition
streamlog.h:29
SerialPortType
#define SerialPortType
Definition
streamlog.h:25
lighthub
streamlog.h
Generated by
1.18.0