ioc: add pvxs_log_config() and pvxs_log_reset()
This commit is contained in:
@@ -37,6 +37,20 @@ served by the Integrated PVA server.
|
||||
Print information about module versions, target, and toolchain.
|
||||
May be requested when reporting a bug.
|
||||
|
||||
.. cpp:function:: void pvxs_log_config(const char *config)
|
||||
|
||||
Enable additional :ref:`logconfig` as if more comma separated key=VALUE pairs
|
||||
were appended to the **$PVXS_LOG** environment variable.
|
||||
|
||||
Since UNRELEASED
|
||||
|
||||
.. cpp:function:: void pvxs_log_reset()
|
||||
|
||||
Reset logging to defaults. Negates the effects of **$PVXS_LOG** and later
|
||||
configuration.
|
||||
|
||||
Since UNRELEASED
|
||||
|
||||
Adding custom PVs to Server
|
||||
---------------------------
|
||||
|
||||
|
||||
@@ -23,6 +23,11 @@ To enable all logging at full detail. ::
|
||||
|
||||
export PVXS_LOG="*=DEBUG"
|
||||
|
||||
To enable all internal logging at INFO detail,
|
||||
and any entries with the prefix "pvxs.foo*" at DEBUG detail. ::
|
||||
|
||||
export PVXS_LOG="pvxs.*=INFO,pvxs.foo*=DEBUG"
|
||||
|
||||
.. doxygenenum:: pvxs::Level
|
||||
|
||||
Controlling Logging
|
||||
|
||||
+17
-3
@@ -165,9 +165,17 @@ void testCleanupPrepare()
|
||||
resetGroups();
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// Two ioc shell commands for pvxs
|
||||
////////////////////////////////////
|
||||
static
|
||||
void pvxs_log_config(const char *str)
|
||||
{
|
||||
logger_config_str(str);
|
||||
}
|
||||
|
||||
static
|
||||
void pvxs_log_reset()
|
||||
{
|
||||
logger_level_clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the PVXS server report.
|
||||
@@ -456,6 +464,12 @@ void pvxsBaseRegistrar() noexcept {
|
||||
|
||||
bool enableQ = enable2();
|
||||
|
||||
IOCShCommand<const char*>("pvxs_log_config", "KEY=VAL,KEY=VAL,...",
|
||||
"Append logger configuration. eg. pvxs_log_config \"pvxs.*=DEBUG\"")
|
||||
.implementation<&pvxs_log_config>();
|
||||
IOCShCommand<>("pvxs_log_clear",
|
||||
"Reset logger configuration to defaults")
|
||||
.implementation<&pvxs_log_reset>();
|
||||
IOCShCommand<int>("pvxsr", "[show_detailed_information?]", "PVXS Server Report. "
|
||||
"Shows information about server config (level==0)\n"
|
||||
"or about connected clients (level>0).\n")
|
||||
|
||||
+10
-5
@@ -340,12 +340,8 @@ void logger_level_clear()
|
||||
logger_gbl->config.clear();
|
||||
}
|
||||
|
||||
void logger_config_env()
|
||||
void logger_config_str(const char *env)
|
||||
{
|
||||
const char *env = getenv("PVXS_LOG");
|
||||
if(!env || !*env)
|
||||
return;
|
||||
|
||||
threadOnce<&logger_prepare>();
|
||||
|
||||
Guard G(logger_gbl->lock);
|
||||
@@ -389,6 +385,15 @@ void logger_config_env()
|
||||
errlogFlush();
|
||||
}
|
||||
|
||||
void logger_config_env()
|
||||
{
|
||||
const char *env = getenv("PVXS_LOG");
|
||||
if(!env || !*env)
|
||||
return;
|
||||
|
||||
logger_config_str(env);
|
||||
}
|
||||
|
||||
} // namespace pvxs
|
||||
|
||||
namespace pvxs {namespace impl {
|
||||
|
||||
@@ -252,6 +252,9 @@ using aligned_union = std::aligned_union<Len, Types...>;
|
||||
} // namespace impl
|
||||
using namespace impl;
|
||||
|
||||
PVXS_API
|
||||
void logger_config_str(const char *env);
|
||||
|
||||
inline
|
||||
timeval totv(double t)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user