{"id":19142686,"url":"https://github.com/jgaa/warlib","last_synced_at":"2025-07-16T05:11:01.356Z","repository":{"id":68076616,"uuid":"107533883","full_name":"jgaa/warlib","owner":"jgaa","description":"A small collection of useful C++ classes targeted for high performance servers.","archived":false,"fork":false,"pushed_at":"2025-03-25T08:49:45.000Z","size":122,"stargazers_count":6,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-06T23:50:56.706Z","etag":null,"topics":["asio","boost-libraries","c-plus-plus","server"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jgaa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-10-19T10:48:24.000Z","updated_at":"2025-03-25T08:49:48.000Z","dependencies_parsed_at":"2024-11-09T07:40:46.044Z","dependency_job_id":"bc853785-c499-4eb4-8daf-fba4a12956e0","html_url":"https://github.com/jgaa/warlib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jgaa/warlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgaa%2Fwarlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgaa%2Fwarlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgaa%2Fwarlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgaa%2Fwarlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgaa","download_url":"https://codeload.github.com/jgaa/warlib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgaa%2Fwarlib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265483769,"owners_count":23774269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asio","boost-libraries","c-plus-plus","server"],"created_at":"2024-11-09T07:28:09.608Z","updated_at":"2025-07-16T05:11:01.339Z","avatar_url":"https://github.com/jgaa.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# warlib\nA small collection of useful C++ classes targeted for high performance servers.\n\n## Logging\nLogging is a pain-point in many C++ projects. My log library was written before boost::log was available, and I must admit that i was a bit disappointed over the complexity of boost:log when it arrived. I have written a handful of logger libraries over the years, and used quite a few in different programing languages. Why so complex? Logging is not all that hard, is it?\n\nWarLog gives you control over what you want to log. You can filter on severity and context, and log-statements that won't be forwarded to any logs are not expanded (the log processing stops after evaluating if the log statement is required).\n\nFor example:\n\n```C++\n  LOG_NOTICE \u003c\u003c \"If we log at notice level, this line will be processed and logged\";\n\n  LOG_DEBUG \u003c\u003c \"While this will not\";\n```\n\nThis is significant if some of your log statement contains method calls that are slow (like pulling stack frames, or context data from variables scattered around in memory). Method calls in the log statements are only called if the data is required at the current log-level.\n\nI usually add *lots* of log statements in my code, much of which I never want to see when things work as expected. Therefore, I have 4 TRACE levels, so that I can log really low-level and frequently called code, and very easily filter it out while still getting lots of details. In a server, like a HTTP server, I may have several layers processing input from the client. I can log the data received over the wire at TRACE level 4, the decompression at level 3, decoding of chunks at level 2, final raw data at level one, and then nicely show what's going on like \"Client at 127.0.0.1 sent a GET request regarding \"/bla/bla\" with headers *headers dumped here* at debug level. That means that if there ever is a problem with, for example, the chunk-decoding (and be sure - there will be if you wrote it yourself!), it's trivial to deduce from the logs what went wrong. But normally, you will only see the high-level debug messages (and higher).\n\nLog levels:\n```C++\n/*! Log Level */\nenum LogLevel {\n    /// Fatal error. The application terminates\n    LL_FATAL,\n    /// Error\n    LL_ERROR,\n    /// Warning\n    LL_WARNING,\n    /// Information. Typically program version, internal modules being enabled etc.\n    LL_INFO,\n    /// Notice. Typically some action that is started or completed.\n    LL_NOTICE,\n    /// Debug messages. These provides verbose information regarding the processing\n    LL_DEBUG,\n    /// Trace message\n    LL_TRACE1,\n    /// Trace message\n    LL_TRACE2,\n    /// Trace message\n    LL_TRACE3,\n    /// Trace message\n    LL_TRACE4\n};\n\n```\n\nWarLog can also filter on context, based on bits. These are the defined values. You are free to add more yourself in your own code.\n\n```C++\nenum LogAbout {\n    /// General message\n    LA_GENERAL  = 0x00000001,\n    /// Security\n    LA_SECURITY = 0x00000002,\n    /// File transfer\n    LA_TRANSFER = 0x00000004,\n    /// Authentication\n    LA_AUTH = 0x00000008,\n    /// IO operations (file system)\n    LA_IO = 0x00000010,\n    /// Network operations (relevant for debug and trace-levels)\n    LA_NETWORK = 0x00000020,\n    /// Threads (relevant for debug and trace-levels)\n    LA_THREADS = 0x00000040,\n    /// Inter process commnication (relevant for debug and trace-levels)\n    LA_IPC = 0x00000080,\n    /// Statistics updates\n    LA_STATS = 0x00000100,\n    /// Function called and left\n    LA_FUNCTION_CALL = 0x00000200\n};\n```\n\nWarLog allows you to log at different log-levels and context flags to different logs. A log may be the console, or it may be a file. You can add any number of logs with their own filters. When a log-message is processed, the message traverse trough each logger until all have seen it. There are global variables caching the lowest log-level used by any log. Messages logged at a lower level will be skipped at run-time.\n\n### Some examples\n\nTBD\n\n\n## Threadpool\n\nTBD\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgaa%2Fwarlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgaa%2Fwarlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgaa%2Fwarlib/lists"}