mirror of
https://github.com/oe7drt/YSFClients.git
synced 2026-04-06 06:43:53 +00:00
Add the logging framework to the Parrot.
This commit is contained in:
parent
20485f5d02
commit
16ef9dcda7
14 changed files with 242 additions and 99 deletions
|
|
@ -16,9 +16,9 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "YSFDefines.h"
|
||||
#include "Network.h"
|
||||
#include "Utils.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
|
|
@ -26,11 +26,10 @@
|
|||
|
||||
const unsigned int BUFFER_LENGTH = 200U;
|
||||
|
||||
CNetwork::CNetwork(unsigned int port, bool debug) :
|
||||
CNetwork::CNetwork(unsigned int port) :
|
||||
m_socket(port),
|
||||
m_address(),
|
||||
m_port(0U),
|
||||
m_debug(debug),
|
||||
m_buffer(1000U, "YSF Network")
|
||||
{
|
||||
}
|
||||
|
|
@ -41,7 +40,7 @@ CNetwork::~CNetwork()
|
|||
|
||||
bool CNetwork::open()
|
||||
{
|
||||
::fprintf(stdout, "Opening YSF network connection\n");
|
||||
LogInfo("Opening YSF network connection");
|
||||
|
||||
return m_socket.open();
|
||||
}
|
||||
|
|
@ -53,8 +52,7 @@ bool CNetwork::write(const unsigned char* data)
|
|||
|
||||
assert(data != NULL);
|
||||
|
||||
if (m_debug)
|
||||
CUtils::dump(1U, "YSF Network Data Sent", data, 155U);
|
||||
CUtils::dump(1U, "YSF Network Data Sent", data, 155U);
|
||||
|
||||
return m_socket.write(data, 155U, m_address, m_port);
|
||||
}
|
||||
|
|
@ -113,8 +111,7 @@ void CNetwork::clock(unsigned int ms)
|
|||
m_address.s_addr = address.s_addr;
|
||||
m_port = port;
|
||||
|
||||
if (m_debug)
|
||||
CUtils::dump(1U, "YSF Network Data Received", buffer, length);
|
||||
CUtils::dump(1U, "YSF Network Data Received", buffer, length);
|
||||
|
||||
m_buffer.addData(buffer, 155U);
|
||||
}
|
||||
|
|
@ -140,5 +137,5 @@ void CNetwork::close()
|
|||
{
|
||||
m_socket.close();
|
||||
|
||||
::fprintf(stdout, "Closing YSF network connection\n");
|
||||
LogInfo("Closing YSF network connection");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue