Skip to content

Commit

Permalink
Checking custom logger return value to keep the default action
Browse files Browse the repository at this point in the history
  • Loading branch information
hoho committed Apr 21, 2015
1 parent fdd1e48 commit e21ba85
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -923,19 +923,21 @@ Local<Value> WinapiErrnoException(Isolate* isolate,


#define LOG_STDERR(...) \
if (custom_logger) \
custom_logger(LOGGER_FUNC_TYPE_STDERR, __VA_ARGS__); \
else { \
if (custom_logger == NULL || \
!custom_logger(LOGGER_FUNC_TYPE_STDERR, __VA_ARGS__)) \
{ \
fprintf(stderr, __VA_ARGS__); \
fflush(stderr); \
}


#define LOG_STDOUT(...) \
if (custom_logger) \
custom_logger(LOGGER_FUNC_TYPE_STDOUT, __VA_ARGS__); \
else \
printf(__VA_ARGS__);
if (custom_logger == NULL || \
!custom_logger(LOGGER_FUNC_TYPE_STDOUT, __VA_ARGS__)) \
{ \
fprintf(stdout, __VA_ARGS__); \
fflush(stdout); \
}


logger_func SetLogger(logger_func func) {
Expand Down

0 comments on commit e21ba85

Please sign in to comment.