52-Line Logging System I wanted to make an extremely light-weight logging system. What are your thoughts on this and what can be done to improve it?
First, the usage:
int main( )
{
    logging::level = logging::fatal | logging::warning;
    mini_log( logging::fatal, &quot;entry point&quot;, &quot;nothing&quot;, &quot; is &quot;, &quot;happening!&quot; );
}

Now, the code:
#if defined( NDEBUG )
#define mini_log( ... ) static_cast&lt; void &gt;( 0 )
#else
namespace logging
{
    enum level_t
    {
        none = 0b00000,
        information = 0b00001,
        debug = 0b00010,
        warning = 0b00100,
        error = 0b01000,
        fatal = 0b10000,
        all = 0b11111   
    } inline level = all; // level should only be used in the entry point
    inline std::mutex stream;
}
#define mini_log \
    [ ]( logging::level_t const level_message, \
         std::string_view const location, \
         auto &amp;&amp;... message ) -&gt; void \
    { \
        std::lock_guard&lt; std::mutex &gt; lock_stream( logging::stream ); \
        struct tm buf; \
        auto time = [ &amp; ]( ) \
        { \
            auto t = std::time( nullptr ); \
            localtime_s( &amp;buf, \
                         &amp;t ); \
            return std::put_time( &amp;buf, \
                                  &quot;[%H:%M:%S]&quot; ); \
        }; \
        auto level = [ = ]( ) -&gt; std::string \
        { \
            switch( level_message ) \
            { \
                case logging::information: \
                    return &quot; [&quot; __FILE__ &quot;@&quot; stringize_val( __LINE__ ) &quot;] [Info] [&quot;; \
                case logging::debug: \
                    return &quot; [&quot; __FILE__ &quot;@&quot; stringize_val( __LINE__ ) &quot;] [Dbug] [&quot;; \
                case logging::warning: \
                    return &quot; [&quot; __FILE__ &quot;@&quot; stringize_val( __LINE__ ) &quot;] [Warn] [&quot;; \
                case logging::error: \
                    return &quot; [&quot; __FILE__ &quot;@&quot; stringize_val( __LINE__ ) &quot;] [Erro] [&quot;; \
                case logging::fatal: \
                    return &quot; [&quot; __FILE__ &quot;@&quot; stringize_val( __LINE__ ) &quot;] [Fatl] [&quot;; \
            } \
        }; \
        if( level_message &amp; logging::level ) \
            ( ( std::cout &lt;&lt; time( ) &lt;&lt; level( ) &lt;&lt; location &lt;&lt; &quot;]: &quot; &lt;&lt; message ) &lt;&lt; ... ) &lt;&lt; '\n'; \
    }
#endif
Macros
Most of your code is in a macro. This makes it harder to write, read and debug.
Why not place the logic in normal functions and only use macros to pass __FILE__ and __LINE__?
That is until you can switch to C++20 which provides std::source_location
Naming
Why is the mutex called stream?