Skip to content

Commit

Permalink
Tick-tock usage of GZ_TRANSPORT_LOG_SQL_PATH
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <methylDragon@gmail.com>
  • Loading branch information
methylDragon committed May 26, 2022
1 parent 7887884 commit e3daa00
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions log/include/gz/transport/log/Log.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ namespace gz
/// \brief Name of Environment variable containing path to schema
const std::string SchemaLocationEnvVar = "GZ_TRANSPORT_LOG_SQL_PATH";

// TODO(CH3): Deprecated. Remove this on ticktock.
const std::string SchemaLocationEnvVarDeprecated = "IGN_TRANSPORT_LOG_SQL_PATH";

/// \brief Interface to a log file
class GZ_TRANSPORT_LOG_VISIBLE Log
{
Expand Down
14 changes: 14 additions & 0 deletions log/src/Log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,20 @@ bool Log::Open(const std::string &_file, const std::ios_base::openmode _mode)
// Test hook so tests can be run before `make install`
std::string schemaFile;
const char *envPath = std::getenv(SchemaLocationEnvVar.c_str());

// TODO(CH3): Deprecated. Remove this on ticktock.
if (!(envPath))
{
envPath = std::getenv(SchemaLocationEnvVarDeprecated.c_str());

if ((envPath))
{
LWRN("Found schema using deprecated environment variable ["
<< SchemaLocationEnvVarDeprecated.c_str()
<< "]. Please use [" << SchemaLocationEnvVar.c_str() << "] instead.")
}
}

if (envPath)
{
schemaFile = envPath;
Expand Down

0 comments on commit e3daa00

Please sign in to comment.