From 5888266152db4ea3e26a9dffcb5d10f32bca36fe Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Fri, 31 May 2024 10:15:01 +0800 Subject: [PATCH] fix --- src/sled/log/log.h | 2 +- src/sled/sled.h | 2 +- src/sled/status.h | 37 +++++++++++++++++++++---------------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/sled/log/log.h b/src/sled/log/log.h index 5218f6f..0cedebb 100644 --- a/src/sled/log/log.h +++ b/src/sled/log/log.h @@ -12,7 +12,7 @@ #include // clang-format off #include // support fmt base ostream -#include +// #include namespace { diff --git a/src/sled/sled.h b/src/sled/sled.h index 95efa7e..a5c475f 100644 --- a/src/sled/sled.h +++ b/src/sled/sled.h @@ -107,7 +107,7 @@ #include "sled/uri.h" // testing -#include "sled/testing/test.h" +// #include "sled/testing/test.h" // debugging diff --git a/src/sled/status.h b/src/sled/status.h index 7e28e6a..8a19ea8 100644 --- a/src/sled/status.h +++ b/src/sled/status.h @@ -8,6 +8,7 @@ #ifndef SLED_STATUS_H #define SLED_STATUS_H +#include "fmt/ostream.h" #include #include #include @@ -15,23 +16,23 @@ namespace sled { enum class StatusCode { - kOk = 0, - kCancelled = 1, - kUnknown = 2, - kInvalidArgument = 3, - kDeadlineExceeded = 4, - kNotFound = 5, - kAlreadyExists = 6, - kPermissionDenied = 7, - kResourceExhausted = 8, + kOk = 0, + kCancelled = 1, + kUnknown = 2, + kInvalidArgument = 3, + kDeadlineExceeded = 4, + kNotFound = 5, + kAlreadyExists = 6, + kPermissionDenied = 7, + kResourceExhausted = 8, kFailedPrecondition = 9, - kAborted = 10, - kOutOfRange = 11, - kUnimplemented = 12, - kInternal = 13, - kUnavailable = 14, - kDataLoss = 15, - kUnauthenticated = 16, + kAborted = 10, + kOutOfRange = 11, + kUnimplemented = 12, + kInternal = 13, + kUnavailable = 14, + kDataLoss = 15, + kUnauthenticated = 16, }; std::string StatusCodeToString(StatusCode code); @@ -102,4 +103,8 @@ std::ostream &operator<<(std::ostream &os, sled::Status const &status); }// namespace sled +namespace fmt { +template<> +struct formatter<::sled::Status> : ostream_formatter {}; +}// namespace fmt #endif// SLED_STATUS_H