$darkmode
cloe::LoggingConf Struct Reference

#include <stack.hpp>

Inheritance diagram for cloe::LoggingConf:
Collaboration diagram for cloe::LoggingConf:

Public Member Functions

void apply () const
 
 CONFABLE_SCHEMA (LoggingConf)
 
bool validate (const Conf &c, std::optional< SchemaError > &err) const override
 
- Public Member Functions inherited from fable::Confable
 Confable (const Confable &) noexcept
 
 Confable (Confable &&) noexcept=default
 
Confableoperator= (const Confable &other) noexcept
 
Confableoperator= (Confable &&other) noexcept
 
virtual void reset_schema ()
 
Schemaschema ()
 
const Schemaschema () const
 
virtual void validate_or_throw (const Conf &c) const
 
virtual void from_conf (const Conf &c)
 
virtual void to_json (Json &j) const
 
Json to_json () const
 

Public Attributes

std::string name
 
boost::optional< std::string > pattern
 
boost::optional< LogLevel > level
 

Additional Inherited Members

- Protected Member Functions inherited from fable::Confable
virtual Schema schema_impl ()
 

Detailed Description

LoggingConf describes a change to the logging system.

"logging": [
{
"name": "*",
"pattern": "%L%L %H:%M:%S.%e [%n] %v",
"level": "debug"
},
{
"level": "debug",
"name": "cloe/simulation"
},
{
"level": "trace",
"name": "cloe/json"
}
]

Given a JSON section, this function takes the following structure:

[
{ name: "*", level: "info" },
{ name: "cloe", level: "debug" },
{ name: "cloe/webserver", level: "warn" },
{ name: "cloe", pattern: "*** [%H:%M:%S %z] [thread %t] %v ***" }
]

That is, each item that configures a logger must specify a name field, then optionally any number of the following fields:

  • level string, which sets the level of the logger
    • trace
    • debug
    • info
    • warn(ing)?
    • err(or)?
    • critical|fatal
    • off|disable
  • pattern string, which sets the output pattern of the logger. Please see this documentation for the syntax of patterns.

A ConfigureException may be thrown.

Member Function Documentation

◆ validate()

bool cloe::LoggingConf::validate ( const Conf c,
std::optional< SchemaError > &  err 
) const
inlineoverridevirtual

Validate a Conf without applying it and without throwing.

By default, this uses the validate() method on schema(). If you want to guarantee anything extending beyond what's possible with schema, you can do that here.

This method should NOT call from_conf without also overriding from_conf to prevent infinite recursion.

This method should not reset err unless the method returns false.

Parameters
cJSON to validate
errreference to store error in
Returns
true if validate successful

Reimplemented from fable::Confable.

Here is the call graph for this function:

The documentation for this struct was generated from the following files: