Skip to content

Commit

Permalink
Postponing logger info
Browse files Browse the repository at this point in the history
  • Loading branch information
ncc14003 committed Feb 11, 2020
1 parent 0700c5f commit e62001b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions breadcrumbs/config/config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int i = 0
13 changes: 10 additions & 3 deletions breadcrumbs/include/Logger.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef LOGGER_HPP
#define LOGGER_HPP
#ifndef LOGGER_H
#define LOGGER_H

#include <stdlib.h>
#include <iostream>
Expand All @@ -11,14 +11,21 @@ using namespace std;



class Logger {
extern class Logger {
public:
int logging_Level = 1;
string filename = "log.txt";


};

void start_log(string filename){
ofstream log_file;
log_file.open(filename, std::ios_base::in | std::ios_base::trunc);
log_file << "Start log";
log_file.close();
}

void write_log(string msg, int msg_level, string filename, Logger* logObject) {
string line;
ofstream log_file;
Expand Down
7 changes: 2 additions & 5 deletions breadcrumbs/src/comms/AlgorithmServer.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

#include "AlgorithmServer.hpp"
#include "Logger.h"
#include <Logger.h>

//Logger* logger = getLogger();

AlgorithmServer::AlgorithmServer(size_t numClients)
{
Expand All @@ -20,7 +19,7 @@ AlgorithmServer::~AlgorithmServer()

void AlgorithmServer::serverThreadRuntime()
{
Logger* logger = getLogger();
//Logger* logger = getLogger();
int iResult;
clientThreadsMutex = CreateMutex(NULL, false, NULL);

Expand Down Expand Up @@ -80,8 +79,6 @@ void AlgorithmServer::serverThreadRuntime()
// Accept a client socket
while (continueThread)
{
Logger* logger = getLogger();
//logger.filename = "log2.txt";
write_log("Listening for clients...\n", 1, logger->filename, logger);
printf("Listening for clients...\n");
ClientSocket = accept(ListenSocket, NULL, NULL);
Expand Down
4 changes: 2 additions & 2 deletions breadcrumbs/src/comms/DataSyncThread.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

//#include <Logger.h>
#include "DataSyncThread.hpp"
#include <Logger.h>
//include<Logger.h>

void DataSyncThread::threadRuntime()
{
Expand Down

0 comments on commit e62001b

Please sign in to comment.