Skip to content

Commit

Permalink
Merge pull request #996 from MFornander/v1.x
Browse files Browse the repository at this point in the history
Add tweak support for user short level names
  • Loading branch information
gabime authored Feb 18, 2019
2 parents c598b2f + 0ccbdcd commit bdfc7d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions include/spdlog/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,12 @@ enum level_enum
"trace", "debug", "info", "warning", "error", "critical", "off" \
}
#endif

static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES;
static const char *short_level_names[]{"T", "D", "I", "W", "E", "C", "O"};

#if !defined(SPDLOG_SHORT_LEVEL_NAMES)
#define SPDLOG_SHORT_LEVEL_NAMES {"T", "D", "I", "W", "E", "C", "O"}
#endif
static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES;

inline string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
{
Expand Down
9 changes: 8 additions & 1 deletion include/spdlog/tweakme.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@
// "MY ERROR", "MY CRITICAL", "OFF" }
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
// Uncomment to customize short level names (e.g. "MT")
// These can be longer than one character.
//
// #define SPDLOG_SHORT_LEVEL_NAMES { "T", "D", "I", "W", "E", "C", "O" }
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
// Uncomment to disable default logger creation.
// This might save some (very) small initialization time if no default logger is needed.
Expand All @@ -142,4 +149,4 @@
// Defaults to __FUNCTION__ (should work on all compilers) if not defined.
//
// #define SPDLOG_FUNCTION __PRETTY_FUNCTION__
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

0 comments on commit bdfc7d2

Please sign in to comment.