Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6964685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:57:21+00:00 2026-05-27T15:57:21+00:00

Im currently implementing a simple Logger for a project due my studies in C++.

  • 0

Im currently implementing a simple Logger for a project due my studies in C++.

I already got a Logger base class, as some different appenders and the next step is to implement verbosity levels.
The problem is that I´m not sure if i understood the concept of verbosity levels correctly and so I wanted to get some feebback before I start to implement them.
So from my understanding a verbosity level in general works as following:

User creates two Logger first:
f.e.:

FileLogger fl; 
VSLogger vl;

afterwards he can set the verbosity level like:

fl.setLoggerLevel(DEBUG);
vl.setLoggerLevel(FATAL_ERROR);

afterwards he can logg as he wants, like:

fl.logg("New Object of Type .... created");
ASSERT(1,2, "1==2");

while assert writes into the VSLogger with fatal error level

and in the Ouput file it would probably look like this:

13:36 Msg: New Object of Type .... created (LEVEL:DEBUG);

and in Visual Studio it would probably look like this:

13:36 Msg: Assert (1==2) failed (LEVEL:FATAL_ERROR)

Is that the sence of a verbosity level or have i missunderstood the concepts of verbosity level in general?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:57:22+00:00Added an answer on May 27, 2026 at 3:57 pm

    I don’t see why the user should have to work with two loggers. The consuming code should not care about logging targets.

    Another issue is that your consuming code doesn’t pass in the severity anywhere. Whenever you call a logging function you pass in the severity. The consuming code doesn’t care what the current verbosity is, it just passes in a severity and relies on the implementation of the logger to know if the severity exceeds the verbosity level. (There is an exception to this rule, where you check against the verbosity level to avoid the overhead of creating the log message in high performance code)

    I’d rather have one logger as the user, with two attached outputs, which might have a different verbosity level.

    In the simplest case I’d create a global function Logger& GetLogger() which leads to user code like GetLogger().LogDebug("New Object of Type .... created");

    First create an interface:

    public class ILogger
    {
      public:
        virtual LogDebug(string message)=0;
        ...
    }
    

    Then create one instance that supports subscription:

    public class DispatchingLogger:ILogger
    {
      private:
        vector<ILogger*> loggers;
      public:
        override LogDebug(string message)
        {
          foreach(ILogger logger in loggers)
          {
            logger.LogDebug(message);
          }
        }
    
        void Subscribe(ILogger* logger)
        {
          loggers.add(logger);
        }
    }
    

    Then the global GetLogger() function returns a single instance of DispatchingLogger. And you can subscribe several implementations with different verbosity levels to it. And user classes that implement ILogger can registered too.

    (I know my C++ syntax is incorrect, has been a bit since I worked with C++)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am currently implementing a simple ray tracer in c++. I have a class
Currently, I'm implementing a simple Tabbed application and I need to show some header
Hello everyone I'm currently implementing a simple programming language for learning experience but I'm
I am currently designing and implementing a small programming language as an extra-credit project
I'm currently implementing a software keyboard ( using some sophisticated prediction ), and drawing
I'm currently trying out Silverlight with RIA Services. I'm implementing a simple login form.
I'm currently in the process of implementing a number of different assignment algorithms for
I am currently implementing Quartz.net in a simple application that should execute a piece
I'm currently implementing a different language ( Shen ) in Clojure. Shen has a
I'm currently implementing a copy constructor for a Linked List class. When I create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.