Cleaned up main file.
- Improved formatting in XPCPlugin.cpp to be consistent throughout the file. - Formatted copyright and license notices to be consistent with the rest of the codebase. - Replaced out of date documentation with a link to the GitHub wiki - Moved the writing of the log header to the Log class and expanded it to include useful information. - Updated Windows binaries
This commit is contained in:
@@ -13,21 +13,44 @@ namespace XPC
|
||||
static void WriteTime(FILE* fd)
|
||||
{
|
||||
time_t rawtime;
|
||||
struct tm* timeinfo;
|
||||
tm* timeinfo;
|
||||
time(&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
|
||||
char buffer[23] = { 0 };
|
||||
char buffer[16] = { 0 };
|
||||
// Format is equivalent to [%F %T], but neither of those specifiers is
|
||||
// supported on Windows as of Visual Studio 13
|
||||
strftime(buffer, 23, "[%Y-%m-%d %H:%M:%S] ", timeinfo);
|
||||
strftime(buffer, 16, "[%H:%M:%S] ", timeinfo);
|
||||
|
||||
fprintf(fd, buffer);
|
||||
}
|
||||
|
||||
void Log::Initialize()
|
||||
void Log::Initialize(std::string version)
|
||||
{
|
||||
FILE* fd = fopen("XPCLog.txt", "w");
|
||||
if (fd != NULL)
|
||||
{
|
||||
time_t rawtime;
|
||||
tm* timeinfo;
|
||||
time(&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
|
||||
char timeStr[16] = { 0 };
|
||||
// Format is equivalent to %F, but neither of those specifiers is
|
||||
// supported on Windows as of Visual Studio 13
|
||||
strftime(timeStr, 16, "%Y-%m-%d", timeinfo);
|
||||
|
||||
fprintf(fd, "X-Plane Connect [Version %s]\n", version.c_str());
|
||||
fprintf(fd, "Copyright (c) 2013-2015 United States Government as represented by the\n");
|
||||
fprintf(fd, "Administrator of the National Aeronautics and Space Administration.\n");
|
||||
fprintf(fd, "All Rights Reserved.\n\n");
|
||||
fprintf(fd, "This file contains debugging information about the X-Plane Connect plugin.\n");
|
||||
fprintf(fd, "If you have technical issues with the plugin, please report them by opening\n");
|
||||
fprintf(fd, "an issue on GitHub (https://github.com/nasa/XPlaneConnect/issues) or by\n");
|
||||
fprintf(fd, "emailing Christopher Teubert (christopher.a.teubert@nasa.gov).\n\n");
|
||||
fprintf(fd, "Log file generated on %s.\n", timeStr);
|
||||
fclose(fd);
|
||||
}
|
||||
}
|
||||
|
||||
void Log::WriteLine(const std::string& value)
|
||||
@@ -37,7 +60,7 @@ namespace XPC
|
||||
|
||||
void Log::WriteLine(const char* value)
|
||||
{
|
||||
FILE* fd = fopen("xpcLog.txt", "a");
|
||||
FILE* fd = fopen("XPCLog.txt", "a");
|
||||
if (!fd)
|
||||
{
|
||||
return;
|
||||
@@ -54,7 +77,7 @@ namespace XPC
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
FILE* fd = fopen("xpcLog.txt", "a");
|
||||
FILE* fd = fopen("XPCLog.txt", "a");
|
||||
if (!fd)
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user