Cleanup, added headers where they were missing. Removed default option ON for unit test.

This commit is contained in:
KjellKod 2013-12-15 22:29:26 -07:00
parent 507ec52c04
commit fe4862a96b
15 changed files with 58 additions and 129 deletions

View File

@ -164,7 +164,7 @@ ENDIF(MSVC)
# 4. unit test for g2log
# remember to unzip gtest at g2log/3rdParty/gtest
option (USE_G2LOG_UNIT_TEST "g2log unit tests" ON)
option (USE_G2LOG_UNIT_TEST "g2log unit tests" OFF)

View File

@ -1,11 +1,9 @@
/*
* File: MessageBuilder.cpp
* Author: kjell
*
* Created on October 26, 2013, 3:45 PM
*/
/** ==========================================================================
* 2013 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
* ============================================================================*/
//#include "g2log.hpp"
#include "g2LogMessageBuilder.hpp"
#include "g2logmessage.hpp"
#include "g2log.hpp"
@ -86,4 +84,4 @@ namespace g2 {
fatalCall(_fatal_message);
}
} // g2
} // g2

View File

@ -1,9 +1,8 @@
/*
* File: MessageBuilder.hpp
* Author: kjell
*
* Created on October 26, 2013, 3:45 PM
*/
/** ==========================================================================
* 2013 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
* ============================================================================*/
#pragma once
#include <string>
@ -46,4 +45,4 @@ namespace g2 {
LogMessagePtr _message;
std::ostringstream _stream;
};
} // g2
} // g2

View File

@ -78,7 +78,7 @@ namespace g2 {
std::ostringstream ss_entry;
// Day Month Date Time Year: is written as "%a %b %d %H:%M:%S %Y" and formatted output as : Wed Sep 19 08:28:16 2012
ss_entry << "\t\tg2log created log at: " << g2::localtime_formatted(g2::systemtime_now(), "%a %b %d %H:%M:%S %Y") << "\n";
ss_entry << "\t\tLOG format: [YYYY/MM/DD hh:mm:ss.uuu* LEVEL FILE:LINE] message\n\n"; // TODO: if(header)
ss_entry << "\t\tLOG format: [YYYY/MM/DD hh:mm:ss.uuu* LEVEL FILE:LINE] message\n\n";
return ss_entry.str();
}

View File

@ -1,39 +0,0 @@
//
//
//#include <g2logmessageimpl.hpp>
//#include <g2time.hpp>
//#include <mutex>
//
//namespace {
// std::once_flag g_start_time_flag;
// g2::steady_time_point g_start_time;
//
// long microsecondsCounter() {
// std::call_once(g_start_time_flag, []() { g_start_time = std::chrono::steady_clock::now(); });
// g2::steady_time_point now = std::chrono::steady_clock::now();
// return std::chrono::duration_cast<std::chrono::microseconds>(now - g_start_time).count();
// }
//
// std::string splitFileName(const std::string& str) {
// size_t found;
// found = str.find_last_of("(/\\");
// return str.substr(found + 1);
// }
//} // anonymous
//
//
//namespace g2 {
// LogMessageImpl::LogMessageImpl(const std::string &file, const int line,
// const std::string& function, const LEVELS& level)
// : _timestamp(g2::systemtime_now())
// , _microseconds(microsecondsCounter())
// , _file(splitFileName(file)), _line(line), _function(function), _level(level) { }
//
//
// LogMessageImpl::LogMessageImpl(const std::string& fatalOsSignalCrashMessage)
// : LogMessageImpl({""}, 0, {""}, internal::FATAL_SIGNAL) {
// _stream << fatalOsSignalCrashMessage;
// }
//} // g2
//
//

View File

@ -1,40 +0,0 @@
//// -*- C++ -*-
///*
// * File: g2logmessageimpl.hpp
// * Author: kjell
// *
// * Created on October 27, 2013, 9:14 PM
// */
//
//#pragma once
//
//
//#include <string>
//#include "g2loglevels.hpp"
//#include <ctime>
//#include <sstream>
//
//namespace g2 {
//struct LogMessageImpl {
//
// // LOG message constructor
// LogMessageImpl(const std::string &file, const int line,
// const std::string& function, const LEVELS& level);
//
// // Fatal OS-Signal constructor
// explicit LogMessageImpl(const std::string& fatalOsSignalCrashMessage);
//
// LogMessageImpl(const LogMessageImpl& copy) = default;
// ~LogMessageImpl() = default;
//
// const std::time_t _timestamp;
// const long _microseconds;
// const std::string _file;
// const int _line;
// const std::string _function;
// const LEVELS _level;
//
// std::string _expression; // only with content for CHECK(...) calls
// std::ostringstream _stream;
//};
//}

View File

@ -1,9 +1,8 @@
/*
* File: g2moveoncopy.hpp
* Author: kjell
*
* Created on November 11, 2013, 11:33 PM
*/
/** ==========================================================================
* 2013 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
* ============================================================================*/
#pragma once
namespace g2 {
@ -36,4 +35,4 @@ namespace g2 {
Moveable release() { return std::move(_move_only); }
};
} // g2
} // g2

View File

@ -1,9 +1,8 @@
/*
* File: g2sink.ipp
* Author: kjell
*
* Created on July 21, 2013, 11:27 AM
*/
/** ==========================================================================
* 2013 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
* ============================================================================*/
#ifndef G2SINK_IPP
#define G2SINK_IPP

View File

@ -1,9 +1,8 @@
/*
* File: g2sinkhandle.hpp
* Author: kjell
*
* Created on July 21, 2013, 11:42 AM
*/
/** ==========================================================================
* 2013 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
* ============================================================================*/
#ifndef G2SINKHANDLE_H
#define G2SINKHANDLE_H

View File

@ -1,9 +1,8 @@
/*
* File: g2sinkwrapper.hpp
* Author: kjell
*
* Created on July 21, 2013, 11:21 AM
*/
/** ==========================================================================
* 2013 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
* ============================================================================*/
#ifndef G2SINKWRAPPER_HPP
#define G2SINKWRAPPER_HPP

View File

@ -1,3 +1,9 @@
/** ==========================================================================
* 2013 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
* ============================================================================*/
#include <gtest/gtest.h>
#include <memory>

View File

@ -245,7 +245,6 @@ TEST(LogTest, LOG_IF__FATAL) {
TEST(LogTest, LOG_IF__FATAL__NO_THROW) {
RestoreFileLogger logger(log_directory);
LOG_IF(FATAL, (2 > 3)) << "This message%sshould NOT throw";
logger.reset();
ASSERT_FALSE(mockFatalWasCalled());
}

View File

@ -1,3 +1,9 @@
/** ==========================================================================
* 2013 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
* ============================================================================*/
#include <gtest/gtest.h>
#include <iostream>
#include <atomic>
@ -69,7 +75,6 @@ TEST(ConceptSink, OneHundredSinks) {
write2.append("Hello to 100 receivers :)");
worker->save(message2);
LOG(INFO) << "end message";
logger.reset();
}
// at the curly brace above the ScopedLogger will go out of scope and all the

View File

@ -1,3 +1,9 @@
/** ==========================================================================
* 2013 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
* ============================================================================*/
#include <gtest/gtest.h>
#include <iostream>

View File

@ -1,9 +1,8 @@
/*
* File: test_helper__restore_logger.h
* Author: kjell
*
* Created on July 13, 2013, 4:46 PM
*/
/** ==========================================================================
* 2013 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
* ============================================================================*/
#pragma once