aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2017-08-23 14:23:43 +0200
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2017-08-23 14:23:43 +0200
commit9dc7dcb8c98e77c2876508589f90ae36c70a2bbe (patch)
tree5fe967c15e0f9f5c0b85f2c1737cd4aed4c6151d
parent5ac4a26f2cf07daf4e0ba0306558920feaf6fabb (diff)
downloadembedlog-9dc7dcb8c98e77c2876508589f90ae36c70a2bbe.tar.gz
embedlog-9dc7dcb8c98e77c2876508589f90ae36c70a2bbe.tar.bz2
embedlog-9dc7dcb8c98e77c2876508589f90ae36c70a2bbe.zip
Added some additional helpful macros
-rw-r--r--include/embedlog.h75
1 files changed, 48 insertions, 27 deletions
diff --git a/include/embedlog.h b/include/embedlog.h
index 0f1a7d1..317a60f 100644
--- a/include/embedlog.h
+++ b/include/embedlog.h
@@ -11,11 +11,25 @@
#include <stdarg.h>
#include <stdio.h>
-#define ELE EL_LEVEL_ERR, __FILE__, __LINE__
-#define ELW EL_LEVEL_WRN, __FILE__, __LINE__
-#define ELI EL_LEVEL_INF, __FILE__, __LINE__
-#define ELD EL_LEVEL_DBG, __FILE__, __LINE__
+#if NOFINFO
+# define ELE EL_LEVEL_ERR, NULL, 0
+# define ELW EL_LEVEL_WRN, NULL, 0
+# define ELI EL_LEVEL_INF, NULL, 0
+# define ELD EL_LEVEL_DBG, NULL, 0
+#else
+# define ELE EL_LEVEL_ERR, __FILE__, __LINE__
+# define ELW EL_LEVEL_WRN, __FILE__, __LINE__
+# define ELI EL_LEVEL_INF, __FILE__, __LINE__
+# define ELD EL_LEVEL_DBG, __FILE__, __LINE__
+#endif
+#if (__STDC_VERSION__ >= 199901L)
+# if NDEBUG
+# define EL_DEBUG(...) ((void)0)
+# else
+# define EL_DEBUG(...) el_print(ELD, __VA_ARGS__)
+# endif
+#endif
enum el_output
{
@@ -87,30 +101,37 @@ struct el_options
const char *fname;
};
+
int el_init(void);
-int el_options_init(struct el_options *);
-int el_level_set(enum el_level);
-int el_olevel_set(struct el_options *, enum el_level);
-int el_output_enable(enum el_output);
-int el_ooutput_enable(struct el_options *, enum el_output);
-int el_output_disable(enum el_output);
-int el_ooutput_disable(struct el_options *, enum el_output);
-int el_option(enum el_option, ...);
-int el_ooption(struct el_options *, enum el_option, ...);
-int el_puts(const char *);
-int el_oputs(struct el_options *, const char *s);
-int el_print(enum el_level, const char *, size_t, const char *, ...);
-int el_oprint(enum el_level, const char *, size_t, struct el_options *,
- const char *, ...);
-int el_vprint(enum el_level, const char *, size_t, const char *, va_list);
-int el_voprint(enum el_level, const char *, size_t, struct el_options *,
- const char *, va_list);
-int el_pmemory(enum el_level, const char *, size_t, const void *, size_t);
-int el_opmemory(enum el_level, const char *, size_t, struct el_options *,
- const void *, size_t);
-int el_perror(enum el_level, const char *, size_t, const char *, ...);
-int el_operror(enum el_level, const char *, size_t, struct el_options *,
- const char *, ...);
+int el_level_set(enum el_level level);
+int el_output_enable(enum el_output output);
+int el_output_disable(enum el_output output);
+int el_option(enum el_option option, ...);
+int el_puts(const char *string);
+int el_print(enum el_level level, const char *file, size_t line,
+ const char *fmt, ...);
+int el_vprint(enum el_level level, const char *file, size_t line,
+ const char *fmt, va_list ap);
+int el_pmemory(enum el_level level, const char *file, size_t line,
+ const void *memory, size_t mlen);
+int el_perror(enum el_level level, const char *file, size_t line,
+ const char *fmt, ...);
+
+
+int el_oinit(struct el_options *options);
+int el_olevel_set(struct el_options *options, enum el_level level);
+int el_ooutput_enable(struct el_options *options, enum el_output output);
+int el_ooutput_disable(struct el_options *options, enum el_output output);
+int el_ooption(struct el_options *options, enum el_option option, ...);
+int el_oputs(struct el_options *options, const char *string);
+int el_oprint(enum el_level level, const char *file, size_t line,
+ struct el_options *options, const char *fnt, ...);
+int el_ovprint(enum el_level level, const char *file, size_t line,
+ struct el_options *options, const char *fmt, va_list ap);
+int el_opmemory(enum el_level level, const char *file, size_t line,
+ struct el_options *options, const void *memory, size_t mlen);
+int el_operror(enum el_level level, const char *file, size_t line,
+ struct el_options *options, const char *fmt, ...);
#endif