Skip to content

Commit

Permalink
Log management for the gimx libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Laurendeau committed Jan 23, 2018
1 parent 96be881 commit c068ea1
Show file tree
Hide file tree
Showing 27 changed files with 43 additions and 46 deletions.
39 changes: 20 additions & 19 deletions Makedefs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ GIMXCONFIGEDITOR_LDFLAGS = -L../shared/gimxconfigeditor \
$(GIMXCONTROLLER_LDFLAGS)
GIMXCONFIGUPDATER_LDFLAGS = -L../shared/gimxconfigupdater
GIMXCONTROLLER_LDFLAGS = -L../shared/gimxcontroller
GIMXHID_LDFLAGS = -L../shared/gimxhid
GIMXINPUT_LDFLAGS = -L../shared/gimxinput \
$(GIMXHID_LDFLAGS)
GIMXPOLL_LDFLAGS = -L../shared/gimxpoll
GIMXPRIO_LDFLAGS = -L../shared/gimxprio
GIMXSERIAL_LDFLAGS = -L../shared/gimxserial
GIMXTIMER_LDFLAGS = -L../shared/gimxtimer
GIMXUHID_LDFLAGS = -L../shared/gimxuhid
GIMXUSB_LDFLAGS = -L../shared/gimxusb
GIMXGPP_LDFLAGS = -L../shared/gimxgpp
GIMXLOG_LDFLAGS = -L../shared/gimxlog
GIMXHID_LDFLAGS = $(GIMXLOG_LDFLAGS) -L../shared/gimxhid
GIMXINPUT_LDFLAGS = $(GIMXHID_LDFLAGS) -L../shared/gimxinput
GIMXPOLL_LDFLAGS = $(GIMXLOG_LDFLAGS) -L../shared/gimxpoll
GIMXPRIO_LDFLAGS = $(GIMXLOG_LDFLAGS) -L../shared/gimxprio
GIMXSERIAL_LDFLAGS = $(GIMXLOG_LDFLAGS) -L../shared/gimxserial
GIMXTIMER_LDFLAGS = $(GIMXLOG_LDFLAGS) -L../shared/gimxtimer
GIMXUHID_LDFLAGS = $(GIMXLOG_LDFLAGS) -L../shared/gimxuhid
GIMXUSB_LDFLAGS = $(GIMXLOG_LDFLAGS) -L../shared/gimxusb
GIMXGPP_LDFLAGS = $(GIMXLOG_LDFLAGS) -L../shared/gimxgpp
GIMXUPDATER_LDFLAGS = -L../shared/gimxupdater

GIMXCONFIGEDITOR_LDLIBS = -lgimxconfigeditor \
Expand All @@ -40,15 +40,16 @@ GIMXCONFIGEDITOR_LDLIBS = -lgimxconfigeditor \
$(GIMXCONTROLLER_LDLIBS)
GIMXCONFIGUPDATER_LDLIBS = -lgimxconfigupdater
GIMXCONTROLLER_LDLIBS = -lgimxcontroller
GIMXHID_LDLIBS = -lgimxhid
GIMXINPUT_LDLIBS = -lgimxinput $(GIMXHID_LDLIBS)
GIMXPOLL_LDLIBS = -lgimxpoll
GIMXPRIO_LDLIBS = -lgimxprio
GIMXSERIAL_LDLIBS = -lgimxserial
GIMXTIMER_LDLIBS = -lgimxtimer
GIMXUHID_LDLIBS = -lgimxuhid
GIMXUSB_LDLIBS = -lgimxusb
GIMXGPP_LDLIBS = -lgimxgpp
GIMXLOG_LDLIBS = -lgimxlog
GIMXHID_LDLIBS = $(GIMXLOG_LDLIBS) -lgimxhid
GIMXINPUT_LDLIBS = $(GIMXHID_LDLIBS) -lgimxinput
GIMXPOLL_LDLIBS = $(GIMXLOG_LDLIBS) -lgimxpoll
GIMXPRIO_LDLIBS = $(GIMXLOG_LDLIBS) -lgimxprio
GIMXSERIAL_LDLIBS = $(GIMXLOG_LDLIBS) -lgimxserial
GIMXTIMER_LDLIBS = $(GIMXLOG_LDLIBS) -lgimxtimer
GIMXUHID_LDLIBS = $(GIMXLOG_LDLIBS) -lgimxuhid
GIMXUSB_LDLIBS = $(GIMXLOG_LDLIBS) -lgimxusb
GIMXGPP_LDLIBS = $(GIMXLOG_LDLIBS) -lgimxgpp
GIMXUPDATER_LDLIBS = -lgimxupdater

ifeq ($(OS),Windows_NT)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $(CLEANDIRS):

ifeq ($(OS),Windows_NT)
DLLS = $(shell ntldd -R {core,config,fpsconfig,launcher}/*.exe | grep mingw | sed "s/.*=> //g" | cut -d' ' -f 1 | sed 's/\\/\\\\/g' | xargs cygpath -u | sort | uniq)\
$(shell ntldd -R {shared/*,shared/*/*/*}/*.dll | grep mingw | sed "s/.*=> //g" | cut -d' ' -f 1 | sed 's/\\/\\\\/g' | xargs cygpath -u | sort | uniq)
$(shell ntldd -R shared/*/*.dll | grep mingw | sed "s/.*=> //g" | cut -d' ' -f 1 | sed 's/\\/\\\\/g' | xargs cygpath -u | sort | uniq)
install: all
mkdir -p setup
for DLL in $(DLLS); \
Expand Down
2 changes: 0 additions & 2 deletions core/connectors/usb_con.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <string.h>
#include <stdlib.h>

#define PRINT_ERROR_OTHER(msg) gerror("%s:%d %s: %s\n", __FILE__, __LINE__, __func__, msg);

#define REPORTS_MAX 2

static struct
Expand Down
2 changes: 1 addition & 1 deletion core/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ int adapter_start()
adapter->activation_button.index = controller_get_activation_button(adapter->ctype);
if (adapter->activation_button.index != 0)
{
printf(_("Press the %s button to activate the controller.\n"), controller_get_axis_name(adapter->ctype, adapter->activation_button.index));
ginfo(_("Press the %s button to activate the controller.\n"), controller_get_axis_name(adapter->ctype, adapter->activation_button.index));
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion core/gimx.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "../directories.h"
#include <gimxprio/include/gprio.h>
#include <gimxusb/include/gusb.h>
#include <gimxlog/include/glog.h>

#define DEFAULT_POSTPONE_COUNT 3 //unit = DEFAULT_REFRESH_PERIOD

Expand Down Expand Up @@ -177,7 +178,7 @@ void show_config()
char line[LINE_MAX];
while (fgets(line, sizeof(line), fp))
{
printf(line);
printf("%s", line);
}
fclose(fp);
}
Expand Down Expand Up @@ -441,6 +442,7 @@ int main(int argc, char *argv[])

if(gimx_params.curses)
{
glog_set_all_levels(E_GLOG_LEVEL_NONE);
gimx_params.curses_status = 1;
display_init();
stats_init(0);
Expand Down
1 change: 0 additions & 1 deletion core/haptic/haptic_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <gimxhid/include/ghid.h>
#include <gimxcontroller/include/controller.h>
#include <gimxcommon/include/glist.h>
#include <gimxcommon/include/gerror.h>
#include <string.h>
#include <stdlib.h>
#include <haptic/haptic_core.h>
Expand Down
1 change: 0 additions & 1 deletion core/haptic/haptic_sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
License: GPLv3
*/

#include <gimxcommon/include/gerror.h>
#include <gimxinput/include/ginput.h>
#include <haptic/haptic_sink.h>
#ifndef WIN32
Expand Down
1 change: 0 additions & 1 deletion core/haptic/haptic_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
License: GPLv3
*/

#include <gimxcommon/include/gerror.h>
#include <string.h>
#include <stdlib.h>
#include <haptic/haptic_source.h>
Expand Down
1 change: 0 additions & 1 deletion core/haptic/sink/haptic_sink_lg.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <controller.h>
#include <gimx.h>
#include <limits.h>
#include <gimxcommon/include/gerror.h>
#include <haptic/haptic_common.h>
#include <haptic/haptic_sink.h>

Expand Down
1 change: 0 additions & 1 deletion core/haptic/sink/haptic_sink_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include <stdlib.h>
#include <gimxinput/include/ginput.h>
#include <gimxcommon/include/gerror.h>
#include <haptic/haptic_common.h>
#include <haptic/haptic_sink.h>

Expand Down
1 change: 0 additions & 1 deletion core/haptic/sink/haptic_sink_rumble.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include <stdlib.h>
#include <gimxinput/include/ginput.h>
#include <gimxcommon/include/gerror.h>
#include <haptic/haptic_common.h>
#include <haptic/haptic_sink.h>

Expand Down
1 change: 0 additions & 1 deletion core/haptic/source/haptic_source_lg.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <stdlib.h>

#include <haptic/common/ff_lg.h>
#include <gimxcommon/include/gerror.h>
#include <haptic/haptic_common.h>
#include <haptic/haptic_source.h>

Expand Down
2 changes: 1 addition & 1 deletion core/haptic/source/haptic_source_rumble.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <stdint.h>
#include <stdlib.h>
#include <gimxcontroller/include/controller.h>
#include <gimxcommon/include/gerror.h>
#include <haptic/haptic_source.h>
#include <limits.h>

static struct {
struct {
Expand Down
4 changes: 4 additions & 0 deletions core/include/gimx.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include <locale.h>
#define _(STRING) gettext(STRING)

#define PRINT_ERROR_OTHER(msg) fprintf(stderr, "%s:%d %s: %s\n", __FILE__, __LINE__, __func__, msg);

#define PRINT_ERROR_ALLOC_FAILED(func) fprintf(stderr, "%s:%d %s: %s failed\n", __FILE__, __LINE__, __func__, func);

typedef enum {
E_GIMX_STATUS_SUCCESS = 0,

Expand Down
2 changes: 0 additions & 2 deletions core/include/haptic/haptic_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@

#define dprintf(...) if(gimx_params.debug.haptic) printf(__VA_ARGS__)

#define PRINT_ERROR_OTHER(msg) fprintf(stderr, "%s:%d %s: %s\n", __FILE__, __LINE__, __func__, msg);

#endif /* HAPTIC_COMMON_H_ */
1 change: 1 addition & 0 deletions core/include/haptic/haptic_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <stddef.h>

#include "haptic_core.h"
#include "haptic_common.h"

struct haptic_source_state;

Expand Down
4 changes: 2 additions & 2 deletions core/macros.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ static void read_configs_txt(const char* dir_path)
configs_txt_present = 1;
while (fgets(line, LINE_MAX, fp)) {
if (gimx_params.logfile != NULL) {
printf(line);
printf("%s", line);
}
if (line[0] != '#') {
// As file names may contain spaces, use '/' as a separator.
Expand Down Expand Up @@ -1154,7 +1154,7 @@ static void read_macros() {
int has_errors = 0;
while (fgets(line, LINE_MAX, fp)) {
if (gimx_params.logfile != NULL) {
printf(line);
printf("%s", line);
}
if (line[0] != '#' && line[0] != '\n' && line[0] != '\r')
{
Expand Down
2 changes: 1 addition & 1 deletion shared/gimxcommon
2 changes: 1 addition & 1 deletion shared/gimxhid
2 changes: 1 addition & 1 deletion shared/gimxlog
Submodule gimxlog updated 2 files
+4 −4 Makedefs
+0 −2 include/glog.h
2 changes: 1 addition & 1 deletion shared/gimxpoll
2 changes: 1 addition & 1 deletion shared/gimxprio
2 changes: 1 addition & 1 deletion shared/gimxserial
2 changes: 1 addition & 1 deletion shared/gimxtimer
2 changes: 1 addition & 1 deletion shared/gimxuhid
Submodule gimxuhid updated 3 files
+5 −1 Makedefs
+3 −0 Makefile
+6 −1 src/linux/uhidasync.c
2 changes: 1 addition & 1 deletion shared/gimxusb
Submodule gimxusb updated 3 files
+5 −1 Makedefs
+3 −0 Makefile
+15 −10 src/gusb.c

0 comments on commit c068ea1

Please sign in to comment.