-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from w23/slightly_better_logs
make it always write all log messages into OpenSource.log And add portal.cfg
- Loading branch information
Showing
11 changed files
with
96 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ tags | |
*.opendb | ||
*.db | ||
*.user | ||
.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
OpenSource.exe portal.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include "filemap.h" | ||
#include "common.h" | ||
#include "log.h" | ||
|
||
#ifndef _WIN32 | ||
#include <sys/types.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "log.h" | ||
|
||
#include <stdio.h> | ||
#include <stdarg.h> | ||
|
||
static struct { | ||
FILE *logfile; | ||
} glog = {0}; | ||
|
||
void logOpen(const char *logfile) { | ||
glog.logfile = fopen(logfile, "w"); | ||
} | ||
|
||
void logClose(void) { | ||
fclose(glog.logfile); | ||
} | ||
|
||
void logPrintf(const char *format, ...) { | ||
va_list args; | ||
va_start(args, format); | ||
|
||
if (glog.logfile) { | ||
va_list args_copy; | ||
va_copy(args_copy, args); | ||
vfprintf(glog.logfile, format, args_copy); | ||
va_end(args_copy); | ||
} | ||
|
||
vfprintf(stderr, format, args); | ||
va_end(args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "common.h" | ||
|
||
void logOpen(const char *logfile); | ||
void logClose(void); | ||
|
||
void logPrintf(PRINTF_ARG(const char *format), ...) PRINTF_ATTR(1, 2); | ||
|
||
#define PRINTF(fmt, ...) logPrintf(__FILE__ ":" STR(__LINE__) ": " fmt "\n", __VA_ARGS__) | ||
#define PRINT(msg) logPrintf(__FILE__ ":" STR(__LINE__) ": %s\n", msg) | ||
|
||
#define ASSERT(cond) if (!(cond)){PRINTF("%s failed", #cond); abort();} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#pragma once | ||
#include "common.h" | ||
#include "log.h" | ||
#include <stddef.h> | ||
|
||
typedef struct Stack { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#include "vmfparser.h" | ||
#include "libc.h" | ||
#include "log.h" | ||
|
||
typedef enum { | ||
VMFTokenType_End, | ||
|