Skip to content

Commit

Permalink
Merge pull request #19 from bonedaddy/cpp
Browse files Browse the repository at this point in the history
Enables Use In C++ Codebases
  • Loading branch information
bonedaddy authored Aug 18, 2020
2 parents 4d93c44 + 7fecbc7 commit 5c75a78
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
10 changes: 9 additions & 1 deletion include/colors.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

#define COLORS_VERSION '0.0.2-rc1'

#define ANSI_COLOR_RED "\x1b[1;31m"
Expand Down Expand Up @@ -70,4 +74,8 @@ void print_colored(COLORS color, char *message);
* @return Success: 0
* @return Failure: 1
*/
int write_colored(COLORS color, int file_descriptor, char *message);
int write_colored(COLORS color, int file_descriptor, char *message);

#ifdef __cplusplus
}
#endif
10 changes: 9 additions & 1 deletion include/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include <stdbool.h>
#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

#define LOGGER_VERSION '0.0.2-rc1'

/*!
Expand Down Expand Up @@ -293,4 +297,8 @@ int write_file_log(int file_descriptor, char *message);
* @param date_buffer the buffer to write the timestamp into
* @param date_buffer_len the size of the buffer
*/
void get_time_string(char *date_buffer, size_t date_buffer_len);
void get_time_string(char *date_buffer, size_t date_buffer_len);

#ifdef __cplusplus
}
#endif
10 changes: 9 additions & 1 deletion src/colors.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#include <string.h>
#include <unistd.h>

#ifdef __cplusplus
extern "C" {
#endif

/*! @brief returns an ansi color string to be used with printf
*/
char *get_ansi_color_scheme(COLORS color) {
Expand Down Expand Up @@ -113,4 +117,8 @@ int write_colored(COLORS color, int file_descriptor, char *message) {
}

return 0;
}
}

#ifdef __cplusplus
}
#endif
10 changes: 9 additions & 1 deletion src/logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include <sys/types.h>
#include <unistd.h>

#ifdef __cplusplus
extern "C" {
#endif

/*! @brief returns a new thread safe logger
* if with_debug is false, then all debug_log calls will be ignored
* @param with_debug whether to enable debug logging, if false debug log calls will
Expand Down Expand Up @@ -345,4 +349,8 @@ void get_time_string(char *date_buffer, size_t date_buffer_len) {

strftime(date_buffer, date_buffer_len, "%b %d %r",
localtime(&(time_t){time(NULL)}));
}
}

#ifdef __cplusplus
}
#endif

0 comments on commit 5c75a78

Please sign in to comment.