IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
log_tag.hxx
Go to the documentation of this file.
1
3
4#pragma once
5#include <ice/hash.hxx>
6#include <ice/string.hxx>
7
8namespace ice
9{
10
11 enum class LogTag : ice::u64
12 {
13 None = 0x0,
14
15 Core = 0x1ull << 0,
16 System = Core << 1,
17 Module = Core << 2,
18 Engine = Core << 3,
19 Asset = Core << 4,
20 Game = Core << 5,
21 Tool = Core << 24,
22 };
23
25 {
28 };
29
30 constexpr auto create_log_tag(LogTag base_tag, ice::String name) noexcept -> LogTagDefinition
31 {
32 ice::u64 const name_hash = ice::hash32(name);
33 ice::u64 const tag_hash = ice::hash(base_tag) << 32;
34 return {
35 .tag = static_cast<LogTag>(tag_hash | name_hash),
36 .name = name
37 };
38 }
39
40 constexpr auto create_log_tag(LogTagDefinition const& base_tag_def, ice::String name) noexcept -> LogTagDefinition
41 {
42 return create_log_tag(base_tag_def.tag, name);
43 }
44
46
47 void log_tag_enable(ice::LogTag tag, bool enabled = true) noexcept;
48
49 namespace detail
50 {
51
52 constexpr auto get_tag(ice::LogTag tag) noexcept
53 {
54 return tag;
55 }
56
57 constexpr auto get_tag(ice::LogTagDefinition const& tag_def) noexcept
58 {
59 return tag_def.tag;
60 }
61
62 } // namespace detail
63
64} // namespace ice
Base class for modules that will automatically register them to be loaded by the module manager.
Definition module.hxx:17
Definition hashmap_details.hxx:13
constexpr auto get_tag(ice::LogTag tag) noexcept
Definition log_tag.hxx:52
SPDX-License-Identifier: MIT.
Definition array.hxx:12
ice::BasicString< char > String
Definition string.hxx:82
@ None
Definition log_severity.hxx:21
void log_tag_enable(ice::LogTag tag, bool enabled=true) noexcept
std::uint64_t u64
Definition types.hxx:27
constexpr auto hash32(ice::String value) noexcept -> ice::u32
Definition string.hxx:105
LogTag
Definition log_tag.hxx:12
@ Asset
Definition log_tag.hxx:19
@ Game
Definition log_tag.hxx:20
@ Engine
Definition log_tag.hxx:18
@ Core
Definition log_tag.hxx:15
@ System
Definition log_tag.hxx:16
@ Tool
Definition log_tag.hxx:21
constexpr auto hash(ice::HeapString<> const &value) noexcept -> ice::u64
Definition heap_string.hxx:251
constexpr auto create_log_tag(LogTag base_tag, ice::String name) noexcept -> LogTagDefinition
Definition log_tag.hxx:30
void log_tag_register(ice::LogTagDefinition tag_def) noexcept
Definition log_tag.hxx:25
ice::LogTag const tag
Definition log_tag.hxx:26
ice::String const name
Definition log_tag.hxx:27