commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
39
include/platform/log/file_log.cpp
Normal file
39
include/platform/log/file_log.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "log/file_log.h"
|
||||
#include "filesystem/filesystem.h"
|
||||
#include "platform.h"
|
||||
|
||||
using namespace GS;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void FileLog::NewLog(const char *log, char entry_level)
|
||||
{
|
||||
if (FILE *f = fopen(path, initial_write ? "w" : "a"))
|
||||
{
|
||||
initial_write = false;
|
||||
|
||||
if (do_timestamp)
|
||||
{
|
||||
String timestamp = Platform::Get().GetTime().toString() + ": ";
|
||||
fwrite(timestamp.c_str(), 1, timestamp.Len(), f);
|
||||
}
|
||||
|
||||
fwrite(log, 1, String::strlen(log), f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
FileLog::FileLog(const char *_path, bool _do_timestamp) : path(_path), do_timestamp(_do_timestamp)
|
||||
{
|
||||
initial_write = true;
|
||||
FILE *f = fopen(path, "w");
|
||||
if(f)
|
||||
fclose(f);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user