diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-10-27 00:37:29 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-10-27 00:37:29 +0200 |
commit | 19a5b01f0b2a4a3609a8a8ed32fba8dd376e1905 (patch) | |
tree | 83368b6ccc154d3da89dd191f1f24050c729a202 /src/utils/log.h | |
parent | eef63c3da8e85f9f155dbc313ec8a87bafd883fd (diff) | |
download | sysc-playground-19a5b01f0b2a4a3609a8a8ed32fba8dd376e1905.tar.gz sysc-playground-19a5b01f0b2a4a3609a8a8ed32fba8dd376e1905.zip |
move utils into subfolder and different files
Diffstat (limited to 'src/utils/log.h')
-rw-r--r-- | src/utils/log.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/utils/log.h b/src/utils/log.h new file mode 100644 index 0000000..49b7ca8 --- /dev/null +++ b/src/utils/log.h @@ -0,0 +1,32 @@ +#ifndef SYSC_PLAYGROUND_LOG +#define SYSC_PLAYGROUND_LOG + +#include <cstdio> + +#define LOG(FMT, ...) \ + do { \ + std::fprintf(stderr, "%10s | %4lld:%2lld | %16s | " FMT "\n", \ + sc_core::sc_time_stamp().to_string().c_str(), \ + sc_core::sc_delta_count(), \ + sc_core::sc_delta_count_at_current_time(), __FUNCTION__, \ + ##__VA_ARGS__); \ + } while (0) + +#define LOGM(FMT, ...) LOG("%12s | " FMT, name(), ##__VA_ARGS__) + +// -- COLOR LOGS --------------------------------------------------------------- + +#define RESET "\e[0m" +#define BLACK "\e[0;30m" +#define RED "\e[0;31m" +#define GREEN "\e[0;32m" +#define YELLOW "\e[0;33m" +#define BLUE "\e[0;34m" +#define MAGENTA "\e[0;35m" +#define CYAN "\e[0;36m" +#define WHITE "\e[0;37m" + +#define CLOG(COL, FMT, ...) LOG(COL FMT "\e[0m", ##__VA_ARGS__) +#define CLOGM(COL, FMT, ...) LOGM(COL FMT "\e[0m", ##__VA_ARGS__) + +#endif |