log4tango::Level(3)

πŸ“¦
version 9.3.4 Β· 2 versions
, in debian bookworm

πŸ’… log4tango::Level β€” the manual page, bestie edition

okay so you're looking at log4tango::Level, which lives in the log4tango manual, section 3. it's giving "log levels but make it a class" and honestly? iconic. no cap. let's get into it 🫢


✨ NAME ✨

log4tango::Level β€” that's the whole vibe, that's the name, periodt.


🌸 SYNOPSIS 🌸

first things first, you gotta let the compiler know you're in:

#include <Level.hh>

πŸŽ€ Public Types πŸŽ€

  • enum LevelLevel { OFF = 100, FATAL = 200, ERROR = 300, WARN = 400, INFO = 500, DEBUG = 600 } β€” literally the levels of priorities. the numbers are NOT vibes, they're real, copy them exactly bestie πŸ”₯
  • typedef int Value β€” this is the type of Level Values. just an int living its truth.

πŸ¦‹ Static Public Member Functions πŸ¦‹

  • static const std::string & get_name (Value level) β€” hands you the name of the level value you passed in. she's static, she's const, she's returning a reference to a std::string, she's everything.
  • static Value get_value (const std::string &level_name) β€” the reverse queen: give her a level name, she gives you back the value.

πŸ’– Member Typedef Documentation πŸ’–

typedef int log4tango::Level::Value

the type of Level Values. that's it, that's the girl. an int in a cute little Value costume ✨


🌈 Member Enumeration Documentation 🌈

enum log4tango::Level::LevelLevel

levels of priorities, in all their glory. the vibe check goes from "everything is fine" all the way down to "we don't talk about it":

Enumerator:

  • OFF
  • FATAL
  • ERROR
  • WARN
  • INFO
  • DEBUG

(and yeah, if you were reading the synopsis, those map to 100, 200, 300, 400, 500, 600 respectively β€” OFF being the smallest number and DEBUG the biggest. cute, right? the more chaos, the bigger the number 😭)


🧚 Member Function Documentation 🧚

const std::string & log4tango::Level::get_name (Value level) [static]

returns the name of the given level value. currently, if the value is not one of the LevelLevel values, the method returns the name of the largest level smaller than the given value. so like, it rounds down to the nearest known level name. she's flexible, she's generous, she's got your back πŸ’…

Parameters

  • level β€” the numeric value of the level.

Returns

  • a string representing the name of the level.

Level::Value log4tango::Level::get_value (const std::string & level_name) [static]

returns the value of the given level name. this can be either one of 'OFF', 'ERRROR', ... or a decimal string representation of the value, e.g. '500' for DEBUG.

not me pointing out that 'ERRROR' is spelled with three R's in the original β€” bestie, that's exactly how it's written, so we keep it. don't @ me, we don't fix the source, we honour it πŸ™ˆ

Parameters

  • level_name β€” the string containing the the of the level
okay the original literally says "the string containing the the of the level" and I'm crying 😭 we're keeping it verbatim, she's a little broken but she's OUR little broken.

Returns

  • the value corresponding with the level name

Exceptions

  • std::invalid_argument β€” thrown if the level_name does not correspond with a known Level name or a number. so if you hand her nonsense, she WILL throw hands. be warned 🚨

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for log4tango from the source code. so nobody hand-wrote this, a robot did, and the robot ate. periodt.


πŸ“ the cute sign-off πŸ“

this page is from log4tango, version 5.0.2, dated Thu Dec 5 2024. thank you for coming to my TED talk, go forth and log responsibly, ily, mwah πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from