Skip to content

Commit

Permalink
Reducing the log level from INFO to DEBUG for most events to make thi…
Browse files Browse the repository at this point in the history
…ngs less verbose.
  • Loading branch information
kwhat committed May 14, 2020
1 parent 54bb180 commit 17a247c
Show file tree
Hide file tree
Showing 12 changed files with 180 additions and 173 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ if (ENABLE_DEMO)
install(TARGETS demo_hook demo_hook_async demo_post demo_properties DESTINATION bin)
endif()

if (ENABLE_TESTS)
if (ENABLE_TEST)
add_executable(uiohook_tests
"./test/input_helper_test.c"
"./test/system_properties_test.c"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $ cmake -S .. -DENABLE_DEMO=ON -DENABLE_SHARED=ON -DCMAKE_INSTALL_PREFIX=../dist
$ cmake --build . --parallel 2 --target install
```

### Options
### Configuration

| | option | description | default |
| --------- | ----------------------------- | ---------------------- | ------- |
Expand All @@ -36,7 +36,7 @@ $ cmake --build . --parallel 2 --target install
| | ENABLE_QUIET:BOOL | copyright suppression | OFF |
| | ENABLE_SHARED:BOOL | shared library | ON |
| | ENABLE_STATIC:BOOL | static library | OFF |
| | ENABLE_TEST:BOOL | testing | ON |
| | ENABLE_TEST:BOOL | testing | OFF |
| __OSX__ | USE_APPLICATION_SERVICES:BOOL | framework | ON |
| | USE_IOKIT:BOOL | framework | ON |
| | USE_OBJC:BOOL | obj-c api | ON |
Expand Down
2 changes: 1 addition & 1 deletion demo/demo_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ bool logger_proc(unsigned int level, const char *format, ...) {
switch (level) {
#ifdef USE_DEBUG
case LOG_LEVEL_DEBUG:
#endif
case LOG_LEVEL_INFO:
va_start(args, format);
status = vfprintf(stdout, format, args) >= 0;
va_end(args);
break;
#endif

case LOG_LEVEL_WARN:
case LOG_LEVEL_ERROR:
Expand Down
2 changes: 1 addition & 1 deletion demo/demo_hook_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ bool logger_proc(unsigned int level, const char *format, ...) {
switch (level) {
#ifdef USE_DEBUG
case LOG_LEVEL_DEBUG:
#endif
case LOG_LEVEL_INFO:
va_start(args, format);
status = vfprintf(stdout, format, args) >= 0;
va_end(args);
break;
#endif

case LOG_LEVEL_WARN:
case LOG_LEVEL_ERROR:
Expand Down
33 changes: 21 additions & 12 deletions demo/demo_properties.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ static bool logger_proc(unsigned int level, const char *format, ...) {

va_list args;
switch (level) {
#ifdef USE_DEBUG
case LOG_LEVEL_DEBUG:
#endif
case LOG_LEVEL_INFO:
va_start(args, format);
status = vfprintf(stdout, format, args) >= 0;
va_end(args);
break;

case LOG_LEVEL_WARN:
case LOG_LEVEL_ERROR:
va_start(args, format);
Expand All @@ -48,49 +57,49 @@ int main() {
// Retrieves the keyboard auto repeat rate.
long int repeat_rate = hook_get_auto_repeat_rate();
if (repeat_rate >= 0) {
fprintf(stdout, "Auto Repeat Rate:\t%ld\n", repeat_rate);
logger_proc(LOG_LEVEL_INFO, "Auto Repeat Rate:\t%ld\n", repeat_rate);
} else {
fprintf(stderr, "Failed to aquire keyboard auto repeat rate!\n");
logger_proc(LOG_LEVEL_ERROR, "Failed to aquire keyboard auto repeat rate!\n");
}

// Retrieves the keyboard auto repeat delay.
long int repeat_delay = hook_get_auto_repeat_delay();
if (repeat_delay >= 0) {
fprintf(stdout, "Auto Repeat Delay:\t%ld\n", repeat_delay);
logger_proc(LOG_LEVEL_INFO, "Auto Repeat Delay:\t%ld\n", repeat_delay);
} else {
fprintf(stderr, "Failed to acquire keyboard auto repeat delay!\n");
logger_proc(LOG_LEVEL_ERROR, "Failed to acquire keyboard auto repeat delay!\n");
}

// Retrieves the mouse acceleration multiplier.
long int acceleration_multiplier = hook_get_pointer_acceleration_multiplier();
if (acceleration_multiplier >= 0) {
fprintf(stdout, "Mouse Acceleration Multiplier:\t%ld\n", acceleration_multiplier);
logger_proc(LOG_LEVEL_INFO, "Mouse Acceleration Multiplier:\t%ld\n", acceleration_multiplier);
} else {
fprintf(stderr, "Failed to acquire mouse acceleration multiplier!\n");
logger_proc(LOG_LEVEL_ERROR, "Failed to acquire mouse acceleration multiplier!\n");
}

// Retrieves the mouse acceleration threshold.
long int acceleration_threshold = hook_get_pointer_acceleration_threshold();
if (acceleration_threshold >= 0) {
fprintf(stdout, "Mouse Acceleration Threshold:\t%ld\n", acceleration_threshold);
logger_proc(LOG_LEVEL_INFO, "Mouse Acceleration Threshold:\t%ld\n", acceleration_threshold);
} else {
fprintf(stderr, "Failed to acquire mouse acceleration threshold!\n");
logger_proc(LOG_LEVEL_ERROR, "Failed to acquire mouse acceleration threshold!\n");
}

// Retrieves the mouse sensitivity.
long int sensitivity = hook_get_pointer_sensitivity();
if (sensitivity >= 0) {
fprintf(stdout, "Mouse Sensitivity:\t%ld\n", sensitivity);
logger_proc(LOG_LEVEL_INFO, "Mouse Sensitivity:\t%ld\n", sensitivity);
} else {
fprintf(stderr, "Failed to acquire mouse sensitivity value!\n");
logger_proc(LOG_LEVEL_ERROR, "Failed to acquire mouse sensitivity value!\n");
}

// Retrieves the double/triple click interval.
long int click_time = hook_get_multi_click_time();
if (click_time >= 0) {
fprintf(stdout, "Multi-Click Time:\t%ld\n", click_time);
logger_proc(LOG_LEVEL_INFO, "Multi-Click Time:\t%ld\n", click_time);
} else {
fprintf(stderr, "Failed to acquire mouse multi-click time!\n");
logger_proc(LOG_LEVEL_ERROR, "Failed to acquire mouse multi-click time!\n");
}

return EXIT_SUCCESS;
Expand Down
Loading

0 comments on commit 17a247c

Please sign in to comment.