feat remove glog
Some checks failed
linux-arm-gcc / linux-gcc-armhf (Release) (push) Waiting to run
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Waiting to run
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Waiting to run
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Waiting to run
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Waiting to run
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Waiting to run
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Waiting to run
linux-x64-clang / linux-clang (Debug) (push) Waiting to run
linux-x64-clang / linux-clang (Release) (push) Waiting to run
linux-x64-gcc / linux-gcc (Debug) (push) Waiting to run
linux-x64-gcc / linux-gcc (Release) (push) Waiting to run
android / build (push) Failing after 9s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Failing after 10s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Failing after 9s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Failing after 9s
linux-arm-gcc / linux-gcc-arm (Release) (push) Failing after 10s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Has been cancelled
linux-x86-gcc / linux-gcc (Debug) (push) Failing after 23s
linux-x86-gcc / linux-gcc (Release) (push) Failing after 21s

This commit is contained in:
tqcq 2024-08-23 21:26:03 +08:00
parent a09f8cc68b
commit 0ff288d0bc
4 changed files with 209 additions and 0 deletions

78
.clang-format Normal file
View File

@ -0,0 +1,78 @@
# Generated from CLion C/C++ Code Style settings
BinPackParameters: false
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignArrayOfStructures: Left
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: true
AcrossComments: false
AlignOperands: DontAlign
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakTemplateDeclarations: Yes
# 函数和返回类型分两行,方便阅读
AlwaysBreakAfterReturnType: TopLevelDefinitions
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
ConstructorInitializerAllOnOneLineOrOnePerLine: true
BreakInheritanceList: BeforeColon
ColumnLimit: 120
CompactNamespaces: false
ContinuationIndentWidth: 4
EmptyLineBeforeAccessModifier: LogicalBlock
SeparateDefinitionBlocks: Always
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PointerAlignment: Right
ReflowComments: false
SortIncludes: CaseSensitive
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never
PenaltyIndentedWhitespace: 1

22
tile/base/log/channel.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef TILE_BASE_LOG_CHANNEL_H
#define TILE_BASE_LOG_CHANNEL_H
#pragma once
#include "tile/base/config/configurable.h"
#include "tile/base/ref_ptr.h"
namespace tile {
namespace log {
class Channel : public Configurable, public RefCounted<Channel> {
public:
void SetProperty(const Slice &name, const Slice &value) override;
std::string GetProperty(const Slice &name) const override;
protected:
~Channel() override;
};
}// namespace log
};// namespace tile
#endif// TILE_BASE_LOG_CHANNEL_H

11
tile/base/log/logger.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef TILE_BASE_LOG_LOGGER_H
#define TILE_BASE_LOG_LOGGER_H
#pragma once
namespace tile {
namespace log {
class Logger {};
}// namespace log
}// namespace tile
#endif// TILE_BASE_LOG_LOGGER_H

98
tile/base/log/message.h Normal file
View File

@ -0,0 +1,98 @@
#ifndef TILE_BASE_LOG_MESSAGE_H
#define TILE_BASE_LOG_MESSAGE_H
#pragma once
#include <cstdint>
#include <map>
#include <string>
namespace tile {
namespace log {
class Message {
public:
typedef std::map<std::string, std::string> StringMap;
enum Priority {
kTrace = 0,
kDebug,
kInfo,
kNotice,
kWarning,
kError,
kCritical,
kFatal,
};
Message();
Message(const Message &other);
Message(Message &&other) noexcept;
~Message();
Message &operator=(const Message &other);
Message &operator=(Message &&other) noexcept;
void swap(Message &other);
// getter
inline const std::string &text() { return text_; }
inline const std::string &source() const { return source_; }
inline Priority priority() const { return priority_; }
inline const std::string &thread_name() const { return thread_name_; }
inline std::uint64_t tid() const { return tid_; }
inline std::uint64_t pid() const { return pid_; }
inline const char *source_file() const { return source_file_; }
inline int source_line() const { return source_line_; }
// setter
inline void set_text(const std::string &text) { text_ = text; }
inline void set_source(const std::string &source) { source_ = source; }
inline void set_priority(Priority priority) { priority_ = priority; }
inline void set_thread_name(const std::string &thread) { thread_name_ = thread; }
inline void set_tid(std::uint64_t tid) { tid_ = tid; }
inline void set_pid(std::uint64_t pid) { pid_ = pid; }
inline void set_source_file(const char *source_file) { source_file_ = source_file; }
inline void set_source_line(int source_line) { source_line_ = source_line; }
// map
const std::string &Get(const std::string &param) const;
const std::string &Get(const std::string &param, const std::string &defult_value) const;
const StringMap &GetAll() const;
void Set(const std::string &param, const std::string &value);
const std::string &operator[](const std::string &param) const;
std::string &operator[](const std::string &param);
private:
std::string text_;
std::string source_;
Priority priority_;
std::string thread_name_;
std::uint64_t tid_;
std::uint64_t pid_;
const char *source_file_;
int source_line_;
StringMap properties_;
};
inline void
swap(Message &lhs, Message &rhs)
{
lhs.swap(rhs);
}
}// namespace log
}// namespace tile
#endif// TILE_BASE_LOG_MESSAGE_H