summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llapr.cpp25
-rw-r--r--indra/llcommon/llapr.h9
-rw-r--r--indra/llcommon/llerror.cpp42
-rw-r--r--indra/llcommon/llerrorcontrol.h7
-rw-r--r--indra/llcommon/llsdutil.cpp8
-rw-r--r--indra/llcommon/llsdutil.h2
-rw-r--r--indra/llcommon/llthread.cpp2
7 files changed, 35 insertions, 60 deletions
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index 86f407cdb0..d353d06de2 100644
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -291,37 +291,20 @@ void LLScopedLock::unlock()
//---------------------------------------------------------------------
-bool ll_apr_warn_status(apr_status_t status)
+bool _ll_apr_warn_status(apr_status_t status, const char* file, int line)
{
if(APR_SUCCESS == status) return false;
#if !LL_LINUX
char buf[MAX_STRING]; /* Flawfinder: ignore */
apr_strerror(status, buf, sizeof(buf));
- LL_WARNS("APR") << "APR: " << buf << LL_ENDL;
+ LL_WARNS("APR") << "APR: " << file << ":" << line << " " << buf << LL_ENDL;
#endif
return true;
}
-bool ll_apr_warn_status(apr_status_t status, apr_dso_handle_t *handle)
+void _ll_apr_assert_status(apr_status_t status, const char* file, int line)
{
- bool result = ll_apr_warn_status(status);
- // Despite observed truncation of actual Mac dylib load errors, increasing
- // this buffer to more than MAX_STRING doesn't help: it appears that APR
- // stores the output in a fixed 255-character internal buffer. (*sigh*)
- char buf[MAX_STRING]; /* Flawfinder: ignore */
- apr_dso_error(handle, buf, sizeof(buf));
- LL_WARNS("APR") << "APR: " << buf << LL_ENDL;
- return result;
-}
-
-void ll_apr_assert_status(apr_status_t status)
-{
- llassert(! ll_apr_warn_status(status));
-}
-
-void ll_apr_assert_status(apr_status_t status, apr_dso_handle_t *handle)
-{
- llassert(! ll_apr_warn_status(status, handle));
+ llassert(! _ll_apr_warn_status(status, file, line));
}
//---------------------------------------------------------------------
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index b1b0fc4718..1ac5c4e9b2 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -52,12 +52,11 @@ struct apr_dso_handle_t;
* APR_SUCCESS.
* @return Returns <code>true</code> if status is an error condition.
*/
-bool LL_COMMON_API ll_apr_warn_status(apr_status_t status);
-/// There's a whole other APR error-message function if you pass a DSO handle.
-bool LL_COMMON_API ll_apr_warn_status(apr_status_t status, apr_dso_handle_t* handle);
+#define ll_apr_warn_status(status) _ll_apr_warn_status(status, __FILE__, __LINE__)
+bool LL_COMMON_API _ll_apr_warn_status(apr_status_t status, const char* file, int line);
-void LL_COMMON_API ll_apr_assert_status(apr_status_t status);
-void LL_COMMON_API ll_apr_assert_status(apr_status_t status, apr_dso_handle_t* handle);
+#define ll_apr_assert_status(status) _ll_apr_assert_status(status, __FILE__, __LINE__)
+void LL_COMMON_API _ll_apr_assert_status(apr_status_t status, const char* file, int line);
extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index cfca42809a..f31a054139 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -312,7 +312,7 @@ namespace
LOG_CLASS(LogControlFile);
public:
- static LogControlFile& fromDirectory(const std::string& dir);
+ static LogControlFile& fromDirectory(const std::string& user_dir, const std::string& app_dir);
virtual bool loadFile();
@@ -322,13 +322,12 @@ namespace
{ }
};
- LogControlFile& LogControlFile::fromDirectory(const std::string& dir)
+ LogControlFile& LogControlFile::fromDirectory(const std::string& user_dir, const std::string& app_dir)
{
- std::string dirBase = dir + "/";
- // NB: We have no abstraction in llcommon for the "proper"
- // delimiter but it turns out that "/" works on all three platforms
+ // NB: We have no abstraction in llcommon for the "proper"
+ // delimiter but it turns out that "/" works on all three platforms
- std::string file = dirBase + "logcontrol-dev.xml";
+ std::string file = user_dir + "/logcontrol-dev.xml";
llstat stat_info;
if (LLFile::stat(file, &stat_info)) {
@@ -336,7 +335,7 @@ namespace
// if it doesn't exist. LLFile has no better abstraction for
// testing for file existence.
- file = dirBase + "logcontrol.xml";
+ file = app_dir + "/logcontrol.xml";
}
return * new LogControlFile(file);
// NB: This instance is never freed
@@ -363,7 +362,7 @@ namespace
}
LLError::configure(configuration);
- LL_INFOS() << "logging reconfigured from " << filename() << LL_ENDL;
+ LL_INFOS("LogControlFile") << "logging reconfigured from " << filename() << LL_ENDL;
return true;
}
@@ -570,9 +569,12 @@ namespace LLError
}
#endif
mFunctionString += std::string(mFunction) + ":";
+ const std::string tag_hash("#");
for (size_t i = 0; i < mTagCount; i++)
{
- mTagString += std::string("#") + mTags[i] + ((i == mTagCount - 1) ? " " : ",");
+ mTagString.append(tag_hash);
+ mTagString.append(mTags[i]);
+ mTagString.append((i == mTagCount - 1) ? ";" : ",");
}
}
@@ -615,7 +617,7 @@ namespace
}
- void commonInit(const std::string& dir, bool log_to_stderr = true)
+ void commonInit(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr = true)
{
LLError::Settings::getInstance()->reset();
@@ -635,7 +637,7 @@ namespace
LLError::addRecorder(recordToWinDebug);
#endif
- LogControlFile& e = LogControlFile::fromDirectory(dir);
+ LogControlFile& e = LogControlFile::fromDirectory(user_dir, app_dir);
// NOTE: We want to explicitly load the file before we add it to the event timer
// that checks for changes to the file. Else, we're not actually loading the file yet,
@@ -651,23 +653,9 @@ namespace
namespace LLError
{
- void initForServer(const std::string& identity)
+ void initForApplication(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr)
{
- std::string dir = "/opt/linden/etc";
- if (LLApp::instance())
- {
- dir = LLApp::instance()->getOption("configdir").asString();
- }
- commonInit(dir);
-#if !LL_WINDOWS
- LLError::RecorderPtr recordToSyslog(new RecordToSyslog(identity));
- addRecorder(recordToSyslog);
-#endif
- }
-
- void initForApplication(const std::string& dir, bool log_to_stderr)
- {
- commonInit(dir, log_to_stderr);
+ commonInit(user_dir, app_dir, log_to_stderr);
}
void setPrintLocation(bool print)
diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h
index 56e84f7172..caf2ba72c2 100644
--- a/indra/llcommon/llerrorcontrol.h
+++ b/indra/llcommon/llerrorcontrol.h
@@ -60,12 +60,7 @@ public:
namespace LLError
{
- LL_COMMON_API void initForServer(const std::string& identity);
- // resets all logging settings to defaults needed by server processes
- // logs to stderr, syslog, and windows debug log
- // the identity string is used for in the syslog
-
- LL_COMMON_API void initForApplication(const std::string& dir, bool log_to_stderr = true);
+ LL_COMMON_API void initForApplication(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr = true);
// resets all logging settings to defaults needed by applicaitons
// logs to stderr and windows debug log
// sets up log configuration from the file logcontrol.xml in dir
diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp
index 6ad4a97149..9d00395c0a 100644
--- a/indra/llcommon/llsdutil.cpp
+++ b/indra/llcommon/llsdutil.cpp
@@ -193,6 +193,14 @@ char* ll_pretty_print_sd(const LLSD& sd)
return buffer;
}
+std::string ll_stream_notation_sd(const LLSD& sd)
+{
+ std::ostringstream stream;
+ stream << LLSDOStreamer<LLSDNotationFormatter>(sd);
+ return stream.str();
+}
+
+
//compares the structure of an LLSD to a template LLSD and stores the
//"valid" values in a 3rd LLSD. Default values pulled from the template
//if the tested LLSD does not contain the key/value pair.
diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h
index 99cb79aa54..01ab6bcb8d 100644
--- a/indra/llcommon/llsdutil.h
+++ b/indra/llcommon/llsdutil.h
@@ -56,6 +56,8 @@ LL_COMMON_API char* ll_print_sd(const LLSD& sd);
LL_COMMON_API char* ll_pretty_print_sd_ptr(const LLSD* sd);
LL_COMMON_API char* ll_pretty_print_sd(const LLSD& sd);
+LL_COMMON_API std::string ll_stream_notation_sd(const LLSD& sd);
+
//compares the structure of an LLSD to a template LLSD and stores the
//"valid" values in a 3rd LLSD. Default values
//are pulled from the template. Extra keys/values in the test
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index e353230791..32e8ea9682 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -437,7 +437,7 @@ LLThreadSafeRefCount::~LLThreadSafeRefCount()
{
if (mRef != 0)
{
- LL_ERRS() << "deleting non-zero reference" << LL_ENDL;
+ LL_ERRS() << "deleting referenced object mRef = " << mRef << LL_ENDL;
}
}