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 8378507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:56:42+00:00 2026-06-09T15:56:42+00:00

I am writing a function as follows: bool abc::GetLoggingStatus() { //true or false is

  • 0

I am writing a function as follows:

bool abc::GetLoggingStatus() {
    //true or false is returned
    int value;
    if (regKey->HasValue("LoggingStatus")) {
        regKey->QueryValue("LoggingStatus", &value);
        if (value == 1)
            return true; //no logging possible
        else
            return false;
    }
    regKey->SetValue("LoggingStatus", 1);
    return true;
}

Logging level is defined as:

typedef enum {
    Entry,
    Exit,
    Debug,
    Warning,
    Notification,
    Error
} TYPE;

What I need if I select 1 the levels for logging must be shown namely debug,error … In regedit and if 0 nothing should be shown and logging be disabled.

  • 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-06-09T15:56:44+00:00Added an answer on June 9, 2026 at 3:56 pm

    You can’t create dropdown menus in regedit, but what you can do is create a new entry called LoggingLevel. This entry is ignored if LoggingStatus is 0. LoggingLevel is a string defining the level.

    If you want to convert this string back to an enum, the easiest way is to create a map from string to your Enum type:

    std::map<std::string, TYPE> typeMap;
    typeMap["Warning"] = Warning;
    ...
    

    In your code you query the logging level:

    char* level;
    regKey->QueryValue("LoggingLevel", level);
    TYPE theLevel = typeMap[level];
    

    Of course you need to do appropriate error checking.

    edit

    You should add two function to get the log settings, shouldLog() and getLevel().
    The log function would then look like:

    void log(Logger* logger, TYPE type, string sClassName, string sMethodName, string sMessage = "") { 
    if (!logger || !abc::shouldLog()) {
       return;
    }
    
    
    TYPE curLevel = abc::getLevel();
    bool shouldLog = false;
    
    if (type == Warning && (curLevel == All || curLevel == Warning) ...) {
      shouldLog = true;
    }
    
    if (shouldLog) {logger->WriteEntry(sClassName, sMethodName); }
    
    }
    

    If you want to avoid complicated if-structures, you could also try and map the enums to a value and compare that. For example Warning = 1 and ALL = 0. Then you can check if curLevel < type to see if the logger should log.

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

Sidebar

Related Questions

I am writing a function short getBits(short data, int p, int n) I have
I have am writing a Python function that takes a timeout value as a
I'm currently writing an application in which I have a function as follows: var
Good day! I am writing a script as follows: var prev = 0; $(document).ready(function(){
I am writing common functions to serialize the given object and List<object> as follows
I am writing function that involve other function from base R with a lot
I'm currently writing a function what would create a zip file, which will be
I'm writing a function, which determine the number of useful bits of a 16
I'm writing a function which will drop a table if it already exists. It
I am writing a function in Haskell that deals with numbers beyond the length

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.