Git Product home page Git Product logo

plog's People

Contributors

bastianseeleib avatar bitmeal avatar chenjianlong avatar civetosh avatar dejan1024 avatar dmgk avatar fbriol avatar foreverr avatar ghostvaibhav avatar gordhub avatar gwankyun avatar hanseuljun avatar hutch avatar jenglamlow avatar kohnech avatar majiclin626 avatar oleksandrtens0r avatar rhd avatar seanchas116 avatar sergiusthebest avatar smorin-primero avatar syaojun avatar thesummer avatar thirtysomething avatar u-1f992 avatar variar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plog's Issues

More parsimonius inclusion of system header files

Currently, including Log.h gives me lots of system header files, most only useful for file appenders or for obtaining the current thread ID. This is not always appropriate. Consider not including the file appenders and the code they require for operation by default, or making their inclusion conditional. Looks like this requires splitting Init.h and Utils.h, and somehow making the thread ID optional.

My scenario requires cross-platform compatibility, I have built an R package that serves only as container for your library. I don't need the file appenders, and splitting took me too long, but I'd be happy to incorporate upstream changes if the library builds on Windows (MinGW), OS X, and Linux.

Thanks for providing the library!

static library logging

Hi,

I've seen your static library example. Is it possible to turn off logging from a library of I'm not interested in seeing its output?

For example: If the library does LOGD << "debug message" a lot and I have a bunch of LOGD << "some other messages" in my main app - is it possible to quite down the logging from the library? Or is it all or nothing?

Thanks!

Apender request

Can you please create an appender that does the same as default (just logs to file) but also does the colour console appender at the same time, so that I don't have to have two loggers, but just one that both outputs to a file and the console in colour at the same time. Thank you

try test the demo with google test and Visual Leak Detector

hi
I try test your sample - demo with Google test and vld for visual studio 2015.

I have memory leak issue need your help. If you could help me to look this issue. I could send you my simple google plog test project code to you.

Thanks

Missing header includes

When installing to /usr/include/plog on a linux box, RollingFileAppender.h seems to be missing

#include <plog/Appenders/IAppender.h>

and IAppender.h

#include <plog/Record.h>

How to write to stdout

Hi!
Every time I use the "LOG_VERBOSE<<1;" it seems to write it to a new line.
Also, in "LOG_VERBOSE<<1<<2;" timestamp and other info are printed twice.
Is there a functionality with which I can control when the newlines are inserted?
In other words, I need something very close to standard 'cout', but with timestamp inserted just once in a line...

Severity level from string?

I'm writing some code where I want to be able to set the severity at runtime based on an input parameter. Looking at Severity.h, I see that there is a way to convert from a Severity to a string, but there is no way to get a Severity from a string.

Obviously I could write my own function to do such a conversion, but do you think it would be valuable to provide such a conversion inside of plog itself? That is, something like: plog::Severity severity_from_string(const string &severity_str)

multiple loggers - different log levels

Hi,

If I want to log info to the console and debug to a file I might do something like this:

    plog::ConsoleAppender<plog::TxtFormatter> consoleAppender;
    plog::init<0>(plog::info, &consoleAppender);

    static plog::RollingFileAppender<plog::TxtFormatter> fileAppender("MultiAppender.txt", 8000, 3);
    plog::init<1>(plog::debug, &fileAppender);

Now hook them up:

plog::get<0>()->addAppender(plog::get<1>());

The problem is that the debug data never makes it to the 2nd logger because it's filtered by the first one.

Is there a workaround for this? Seems appenders are really for logging the same data to multiple sinks.

The only thing that works is if I make sure to have the most verbose logger as logger <0> - then data flows to the 2nd logger.

Thanks for the great library!

Visual Studio or QT console

Hi,

May I suggest to add this

#if defined(_DEBUG) && defined(_WIN32)
    OutputDebugString( ...)
#endif

to the ColorConsoleAppender for allowing outputting text in the VS or QT console ? Of course we will loose coloring but it is more convenient when debugging.

Error: ::_wsopen_s has not been defined

Relevant section from my console output on compile

C:\Users\heybr\plog-1.0.1\include/plog/Util.h:220:17: error: '::_wsopen_s' has not been declared
             ::_wsopen_s(&m_file, fileName, _O_CREAT | _O_WRONLY | _O_BINARY, _SH_DENYWR, _S_IREAD | _S_IWRITE);
             ^

Code used is the hello log code from the readme, compiled on MinGW G++

Macro name conflict

While it is convenience to use the short name macro however they are very easy to conflict with other code, especially:

  • LOG
  • LOGD

It's better that plog provide a longer macro name with PLOG_ prefix or something to avoid such conflict and let user to define there short hand name if needed:

#include <plog/Log.h>

#define MY_LOG PLOG_LOG

MY_LOG(info) << "Will not conflict any more :)";

__FILE__

Hello !

Is there any reason why the LOG_ macro (and the LogRecord object) does not record the original file where the LOG_ statement happened, using FILE ?

Thank you

WIN32_LEAN_AND_MEAN

Hi,

What do you think about including

#ifndef WIN32_LEAN_AND_MEAN
    #define WIN32_LEAN_AND_MEAN
#endif
#include <window.h>

before including#include <window.h> in Util.h?

This could prevent many headache of juggling with order of inclusion of plog.h when preceding headers already include (winsock.h | winsock2.h) ?

Related problems :
http://stackoverflow.com/questions/1372480/c-redefinition-header-files-winsock2-h
http://stackoverflow.com/questions/11726958/cant-include-winsock2-h-in-msvc-2010
http://stackoverflow.com/questions/11495589/winsock-redefinition-errors
https://connect.microsoft.com/VisualStudio/feedback/details/3123533/c-problem-windows-h-win32-mean-and-lean ?!?
microsoft/vcpkg#591
There a many many many other like this...

I already tried to replace window.h from Util.h as we should always avoid including window.h as it's a mess. But (in a short time) I did not succeed because of functions depending on WinBase.h and this former can't be included without including The Bad and the Ugly Windows.h.

Best regards,

error on ConsoleAppender

I'm trying to use multi appender sample

static plog::RollingFileAppenderplog::CsvFormatter fileAppender("MultiAppender.csv", 8000, 3); // Create the 1st appender.
static plog::ConsoleAppenderplog::TxtFormatter consoleAppender; // Create the 2nd appender.
plog::init(plog::debug, &fileAppender).addAppender(&consoleAppender); // Initialize the logger with the both appenders.

but I get the error:
error: ‘ConsoleAppender’ in namespace ‘plog’ does not name a template type

I'm using gcc 4.9.4 on ubuntu 14.04 wiht Eclipse 3.8

const char * : unhandled exception in lib <string>

When i use plog in my main i have no problems,

but i wanna use it on other function but i got unhandled exception in visual studio.

my call was something like that :

LOGI << "Some text here";

I correct first the problem by adding always std::string constructor in my debug text but it was really boring

LOGI << std::string("Some text here");

Finally I correct the problem by adding this in record.h

		Record& operator<<(const const char* data)
		{
			using namespace plog::detail;

			m_message << std::string(data);
			return *this;
		}

Do you have any idea what is wrong ?

No documented way to de-initialize

I really like this library. There's only one thing I"m missing though, it doesn't seem to be possible to de-initialize (close/shutdown) a log. Would it be possible to implement this?

Use case, I want a logger to start when the initialize function in my library is used. It is possible to run terminate in my library and than rerun initialize, but from that point on, the logger is printing every single log message twice. So, in my terminate function, I need to shut down the log.

EventLogAppender not working

Hi Sergey,

looks that the EventLogAppender is no longer working. I was not able to create event log entries. More worse is that the chaining of RollingFileAppender and EventLogAppender will result in nothing logged at all.

I'm using the following code for init:

std::string ProgName = _T("PlogTest");
CString LogFileName;
LogFileName.Format(_T("C:\\Temp\\%s.log"), ProgName.c_str());
static plog::RollingFileAppender<plog::TxtFormatter> LogFile(LogFileName, 1000000, 5);
std::wstring EventLog = std::wstring(ProgName.begin(), ProgName.end());
if (false == plog::EventLogAppenderRegistry::exists(EventLog.c_str()))
{
	plog::EventLogAppenderRegistry::add(EventLog.c_str());
}
static plog::EventLogAppender<plog::TxtFormatter> LogEvent(EventLog.c_str());
plog::init(plog::verbose, &LogFile).addAppender(&LogEvent);

I've tested both, with and without admin privileges and got the same result. The OS user has local admin privileges.

The project specific settings are:

  • Platformtoolset Visual Studio 2010 (v100)
  • Usage of MFC in a common used DLL
  • Using Multibyte character set
  • No optimizing

The OS is Win7 Pro 64 and I'm working with Visual Studio 2013.

Loggin with QT (QString)

Hi,

What is the better way to introduce QT (QString) support with plog ? Do I have to add a implement a Custom converter ?

Also, is there any problem using this library with multiple project ? Ex : I have a main application that is loading a DLL. I want the DLL to output to the same log file as the main application.

IF_LOG_ macro in if/else leads to miss else branch

The code below expects to output 'false'.

#include "plog/Log.h"

int main()
{
    plog::init(plog::info, "test.txt");

    LOG_INFO << "start";

    if (false)
        LOG_INFO << "true";
    else
        LOG_INFO << "false";

    LOG_INFO << "end";
}

2016-09-23 10:27:44.875 INFO [1820] [main@13] start
2016-09-23 10:27:44.876 INFO [1820] [main@20] end

It seems that the IF_LOG_ macro which has 'if ' leads to miss else branch.

DebugOutputAppender (Support linux to avoid compilation error)

What do you think of :

#pragma once

namespace plog
{
    template<class Formatter>
    class DebugOutputAppender : public IAppender
    {
    public:
        virtual void write(const Record& record)
        {
#if defined(_WIN32) && defined(_MSC_VER)  // Win32 and Visual Studio
            ::OutputDebugStringW(Formatter::format(record).c_str());
#elif defined(QT_VERSION) // Linux on Qt
            qDebug() << record; 
#else // Anything else...
            std::cerr << record;
#endif
        }
    };
}

Chained loggers assetion failed

Hello. I'm trying to use plog in my application and static library (as in example):

// In library
void GL::enableLogging(plog::Severity maxSeverity, plog::IAppender* appender)
{
	plog::init(maxSeverity, appender);
}
// In application
void initializeLogging(const std::string& filename, plog::Severity maxSeverity)
{
	static plog::RollingFileAppender<Formatter> fileAppender(filename.c_str(), 8000, 1);
	static plog::ConsoleAppender<Formatter> consoleAppender;
	plog::init(maxSeverity, &fileAppender).addAppender(&consoleAppender);

	GL::enableLogging(maxSeverity, plog::get());
}

And I got folowing assertion failed:

Logger<instance> &plog::Logger<0>::addAppender(plog::IAppender *) [instance = 0]: Assertion `appender != this' failed.

If I pass &consoleAppender instead of plog::get, all messages are duplicated in console.
Am I doing something wrong?

Best regards.

Truncating file when creating RollingFileAppender?

Is there a way to truncate an existing log file when creating a RollingFileAppender? That is, I have a foo.log from a previous execution and when I execute the program again, I want foo.log to be overwritten.

It appears that plog specifically seeks to the end of the file when opening it. Is it worthwhile to have a flag that overrides this behavior?

Log not flushed

I seen that "util::File" class not flushes text.
I see that pLog uses "open" and "close" functions that are not POSIX compliant and, at least in Linux, the "close" function only close file descriptor without flushing text: so the output maybe truncated.

Is it better to use the "fopen" and "fclose" functions?

Can you fix this issue? It is a big problem for me.

Kind regards

Crash when logging inside an Objective-C function.

Plog crashes when using LOG_INFO inside an Objective-C function. Here is the crash report call stack:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 plog::util::processFuncName(char const*) + 89 (Util.h:166)
1 plog::Record::getFunc() const + 35 (Record.h:120)
2 plog::TxtFormatter::format(plog::Record const&) + 5139 (TxtFormatter.h:25)
3 plog::RollingFileAppender<plog::TxtFormatter, plog::UTF8Converter>::write(plog::Record const&) + 223 (RollingFileAppender.h:35)
4 plog::Logger<0>::operator+=(plog::Record const&) + 408 (Logger.h:50)
5 -[MyCocoaView mouseDown:] + 62 (toolkitview_cocoa.mm:345)
...

ColorConsoleAppender thread safe

Hi there!
Currently the ColorConsolAppender is not thread safe. The colors can be mixed together during console printing.
Then you should introduce a mutex, as done in RollingFileAppender.

Thank you!

Time based rolling file appender

Hi,
I needed a time based rolling file appender.
I attach the modified files to achieve this functionality.

I ask you to review it and to include in the next version on plog with the all related adjustments.

plog.zip

expected an identifier?

Hi, i'm using VS2012, my program complies&runs fine.
But the editor continues to report errors like:
IntelliSense: expected an identifier path_to_cpp_file_where_calls_LOGD

What's going on there?

Chained sample crashes if DLL and EXE are built with different version of Visual Studio

@purell found that binary compatibility is broken:

I properly follow the instruction for Chained Loggers but now I'm getting a crash (Access violation) when the shared library is doing the first log operation.

App

QString sApplicationFilePath = QCoreApplication::instance()->applicationFilePath();
QFileInfo fileInfo(sApplicationFilePath);
QString sLogFilePath = QDir::cleanPath( QDir( fileInfo.path() ).filePath( fileInfo.baseName() + ".log" ) );
static plog::RollingFileAppender<plog::TxtFormatter> fileAppender(sLogFilePath.toUtf8(), 1048576, 1);
plog::init(plog::debug, &fileAppender)

// Initialize the logger in the shared library.
CacheInitializePLog(plog::debug, plog::get());

Shared library

void CacheInitializePLog(plog::Severity severity, plog::IAppender* appender) {

    // Initialize the library logger
    plog::init(severity, appender);
}

Stack trace

MyApp.exe!std::char_traits<char>::length(const char * _First) Line 523	C++
MyApp.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign(const char * _Ptr) Line 1169	C++
MyApp.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >(const char * _Ptr) Line 783	C++
MyApp.exe!plog::util::processFuncName(const char * func) Line 149	C++
MyApp.exe!plog::Record::getFunc() Line 122	C++
MyApp.exe!plog::TxtFormatter::format(const plog::Record & record) Line 25	C++
MyApp.exe!plog::RollingFileAppender<plog::TxtFormatter,plog::UTF8Converter>::write(const plog::Record & record) Line 46	C++
MyApp.exe!plog::Logger<0>::operator+=(const plog::Record & record) Line 54	C++
MyApp.exe!plog::Logger<0>::write(const plog::Record & record) Line 48	C++
MyShared.dll!plog::Logger<0>::operator+=(const plog::Record & record) Line 54	C++
MyShared.dll!DoSomething() Line 61	C++

The stack around Record seem to be corrupted on the line

MyApp.exe!plog::Logger<0>::write(const plog::Record & record) Line 48   C++

Converter on the QT side

plog::Record& plog::operator << (plog::Record& record, const QString& msg)
{
	return record << msg.toStdString();
}

QT Configuration

win32 {
    DEFINES -= UNICODE _UNICODE
    DEFINES += _MBCS _WIN32
}

I'm on this problem since yesterday and I've never found the solution yet. I'm about to give up.

The shared library and the app are build without _UNICODE support/defined. Thus, at the beginning I though that the problem could be here :

    namespace util
    {
#ifdef _WIN32
        typedef std::wstring nstring;
        typedef std::wstringstream nstringstream;
        typedef wchar_t nchar;
#else
        typedef std::string nstring;
        typedef std::stringstream nstringstream;
        typedef char nchar;
#endif

No test are done for _UNICODE macro, but I finally conclude those typedef are probably for your internal string operation. When we are using the << operator for logging, you convert it according the user input type.

I found that compiling the shared library with Visual Studio 2013 instead of Visual Studio 2008 do not produce the crash. But I'm stuck with VS 2008 for the time being.

Maybe this ?
Visual C++ change history 2003 - 2015

To implement various optimizations and debugging checks, the C++ Standard Library implementation intentionally breaks binary compatibility among versions of Visual Studio (2005, 2008, 2010, 2012). When the C++ Standard Library is used, this forbids the mixing of object files and static libraries that are compiled by using different versions into one binary (EXE or DLL), and forbids the passing of C++ Standard Library objects between binaries that are compiled by using different versions. The mixing of object files and static libraries (using the C++ Standard Library) that were compiled by using Visual C++ 2010 with those that were compiled by using Visual C++ in Visual Studio 2012 emits linker errors about _MSC_VER mismatch, where _MSC_VER is the macro that contains the compiler's major version (1700 for Visual C++ in Visual Studio 2012). This check cannot detect DLL mixing, and cannot detect mixing that involves Visual C++ 2008 or earlier.

Support operator<<(std::ostream& os, ...) custom operators on Windows

Currently it's difficult to use the same code across platforms because Plog expects operator<< to use std::wostream on Windows, while on Linux (and OSX?) you need to use std::ostream. Thus code that builds on Linux fails to build on Windows and the other way around.

If there are other ways to have common operators across platforms I'd love to know.

Error with String^

Hello,

First, i want to thank you for this log system.
Your addon is very cool and i wouldn't drop it to another one.
But i got an error which forbids me to continue.
I can't use String in any project or i get an error.
The compile debug says that i need to put an "^" after String.

It is working fine. But, if i want to "log" a string^ variable nammed "port" with "LOGI", i get an error.
I also tried "&port" but in the log i got an var adress (Pointer) instead of variable.

I'm Visual Studio 2017 and C++ language.

My Code : https://pastebin.com/P1cRMR8S
The error : https://pastebin.com/CGviZRbe

Thanks really for service,
Tom

Log flushed to disk only at end of my program

Hi,

I call plog::init(plog::verbose, "log.txt") at the beggining of my program. During execution, I call LOG_INFO
several times. I want to monitoring the execution of my program by examining the log file (my program runs for a long time), but the log file is flushed to disk only at the end of my program.

How to force flushing at each logged message (I don't care about the performance)?

Thanks!

plog::Logger construction problem

Please could you explain under what circumstances will the logger not be constructed correctly? (I am using plog in an injected dll)

Code is as per docs:

plog::init(plog::verbose, logFilename, LOG_FILE_SIZE, NO_OF_LOG_FILES);
DebugTrace(L"plog::get<0>=%p", plog::get<0>());

Output:
plog::get<0>=0000000000000000

I inserted trace statements into object constructors and determined that plog::init is being called ok but Logger constructor is not. Debug output shows LOGGER INIT but not LOGGER CONSTRUCTOR from edits below. Why?

inline Logger<instance>& init(Severity maxSeverity = none, IAppender* appender = NULL)
 {
  static Logger<instance> logger(maxSeverity);

  OutputDebugStringW(L"LOGGER INIT");

  return appender ? logger.addAppender(appender) : logger;
}

Logger(Severity maxSeverity = none) : m_maxSeverity(maxSeverity)
{
  OutputDebugStringW(L"LOGGER CONSTRUCTOR");
}

Stream manipulators support

Hi,
you can find attached my proposal to add stream manipulators support to plog.

plog.zip

I have tried with the following manipulators and it works: std::dec, std::hex, std::oct, std::endl, std::left, std::setfill, std::setprecision, std::setw.

Can you review and include it in the next version of plog?

Error macro

Hi,
I use CLION JetBrains IDE C / C ++.

  1. plog::init(plog::info, x.substr(6, x.size()).append("/").append("createfp.log").c_str());

  2. LOGI << "INIT\n";
    ....
    The compile and run program is ok. but there is program :

Problem synopsis   Error after macro substitution: Pointer type is required at line xxxx

Help me?
Thanks.

Issue in Qt callbacks

Hello,

First of all, thanks for this pretty useful and easy-to-use lib. :)

I'm having an issue using it with Qt, the calls to LOG_DEBUG within a Qt callback (and subsequent calls) are not written in my output file.

I wonder if this is due to threads (possibly) created by Qt to manage its callbacks.

Is there something specific to do in order to use the logger in these callbacks ? Am I missing something ?

Thank you,

d!

Signed unsigned assignment warning

RollingFileAppender.h
Line 76 should have explicit type casting to avoid warnings on platforms like osX
m_fileSize = **(size_t)**m_file.open(fileName.c_str());

Changing global locale in ConsoleAppender

On windows ConsoleAppender constructor changes locale with ::setlocale(LC_ALL, ""). That may cause troubles. https://github.com/SergiusTheBest/plog/blob/master/include/plog/Appenders/ConsoleAppender.h#L15
We are using PLOG in a dynamic library. It may be linked to a binary that may depend on locale settings (in our case it sets and expects "C" locale).

In case changing locale is required for PLOG library I believe it can be done locally using imbue http://en.cppreference.com/w/cpp/io/basic_ios/imbue.

osx error: "xxxxx.h" file not found

ide: xocde

  • .c
#include <stdio.h>
#include <plog/Log.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    printf("Hello, World!\n");
    return 0;
}
  • build settings - header search paths:
/Users/xoraxrax/Downloads/plog-1.1.3/include
  • error log:

Showing Recent Messages
CompileC /Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Intermediates/test.build/Debug/test.build/Objects-normal/x86_64/main.o test/main.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/xoraxrax/Documents/project/test
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fmodules -gmodules -fmodules-cache-path=/Users/xoraxrax/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/xoraxrax/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.12 -g -Wno-sign-conversion -Winfinite-recursion -iquote /Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Intermediates/test.build/Debug/test.build/test-generated-files.hmap -I/Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Intermediates/test.build/Debug/test.build/test-own-target-headers.hmap -I/Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Intermediates/test.build/Debug/test.build/test-all-target-headers.hmap -iquote /Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Intermediates/test.build/Debug/test.build/test-project-headers.hmap -I/Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Products/Debug/include -I/Users/xoraxrax/Downloads/plog-1.1.3/include -I/Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Intermediates/test.build/Debug/test.build/DerivedSources/x86_64 -I/Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Intermediates/test.build/Debug/test.build/DerivedSources -F/Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Products/Debug -MMD -MT dependencies -MF /Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Intermediates/test.build/Debug/test.build/Objects-normal/x86_64/main.d --serialize-diagnostics /Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Intermediates/test.build/Debug/test.build/Objects-normal/x86_64/main.dia -c /Users/xoraxrax/Documents/project/test/test/main.c -o /Users/xoraxrax/Library/Developer/Xcode/DerivedData/test-dvgvdptghlqeyfgegjjcugbsmepj/Build/Intermediates/test.build/Debug/test.build/Objects-normal/x86_64/main.o

In file included from /Users/xoraxrax/Documents/project/test/test/main.c:10:
In file included from /Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Log.h:7:
In file included from /Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Logger.h:2:
In file included from /Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Appenders/IAppender.h:2:
In file included from /Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Record.h:2:
/Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Severity.h:3:1: error: unknown type name 'namespace'
namespace plog
^
/Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Severity.h:3:15: error: expected ';' after top level declarator
namespace plog
              ^
              ;
In file included from /Users/xoraxrax/Documents/project/test/test/main.c:10:
In file included from /Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Log.h:7:
In file included from /Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Logger.h:2:
In file included from /Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Appenders/IAppender.h:2:
In file included from /Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Record.h:3:
/Users/xoraxrax/Downloads/plog-1.1.3/include/plog/Util.h:2:10: fatal error: 'cassert' file not found
#include <cassert>
         ^
3 errors generated.

-liconv needed for compilation on Mac OS X 10.10

Just a minor suggestion: it might be useful to note somewhere that in order to get compilation on Mac OS X 10.10 (and possibly later, though I haven't checked) to work, you need to explicitly link to the iconv library ("-liconv").

Plog in library

Hi, i'm trying to init plog in both my library and demo executable. Like this:

plog::init(plog::warning, FileUtil::Instance()->GetAbsPath("Log.txt").c_str()).addAppender(
    new plog::ConsoleAppender<plog::FuncMessageFormatter>());
// my library using plog
Engine::InitPlog(plog::warning, plog::get());
// Engine::initPlog function
static void InitPlog(plog::Severity severity, plog::IAppender* appender)
{
    plog::init(severity, appender);
}

On windows everything is fine, but the same code report errors on osx.
Assertion failed: (appender != this), function addAppender, file /Users/xinhou/Documents/Sdk/Plog/include/plog/Logger.h, line 18.

Compiler:
Apple LLVM version 7.0.2 (clang-700.1.81)

What could possiblly be wrong ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.