diff options
Diffstat (limited to 'linden/indra/llcommon/llerrorbuffer.h')
-rw-r--r-- | linden/indra/llcommon/llerrorbuffer.h | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/linden/indra/llcommon/llerrorbuffer.h b/linden/indra/llcommon/llerrorbuffer.h deleted file mode 100644 index b52de3a..0000000 --- a/linden/indra/llcommon/llerrorbuffer.h +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /** | ||
2 | * @file llerrorbuffer.h | ||
3 | * @brief Buffer implementation for logging. | ||
4 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_LLERRORBUFFER_H | ||
29 | #define LL_LLERRORBUFFER_H | ||
30 | |||
31 | #include <fstream> | ||
32 | #include <iostream> | ||
33 | #include <string> | ||
34 | |||
35 | #include "lldefs.h" | ||
36 | #include "stdtypes.h" | ||
37 | #include "llfile.h" | ||
38 | |||
39 | // A streambuf that sends it's output into a file, stderr, or syslog. | ||
40 | // | ||
41 | // Each output can be enabled/disabled, and a priority can be set. | ||
42 | |||
43 | class LLFixedBuffer; | ||
44 | |||
45 | class LLErrorBuffer : public std::streambuf | ||
46 | { | ||
47 | public: | ||
48 | |||
49 | // Specify error levels | ||
50 | enum ELevel | ||
51 | { | ||
52 | DEBUG = 0, | ||
53 | INFO = 1, | ||
54 | WARN = 2, | ||
55 | FATAL = 3, | ||
56 | NONE = 4 // Do NO error logging (for use in signal handlers) | ||
57 | }; | ||
58 | |||
59 | LLErrorBuffer(); | ||
60 | ~LLErrorBuffer(); | ||
61 | BOOL setFile(const char *filename); | ||
62 | void closeFile(); | ||
63 | const char *getFilename() const; | ||
64 | void setFixedBuffer(LLFixedBuffer *b) { mFixedBuf = b; }; | ||
65 | |||
66 | // Sets the priority of the current message | ||
67 | void setPriority(const ELevel l) { mPriority = l; } | ||
68 | |||
69 | // Only display messages >= to this level | ||
70 | void setLevel(const ELevel l) { mLevel = l; } | ||
71 | ELevel getLevel() { return mLevel; } | ||
72 | // Display messages >= to level l, if l < current level | ||
73 | ELevel mergeLevel(const ELevel l); | ||
74 | |||
75 | // on linux, this sets syslog info to be a LOG_NOTICE which will | ||
76 | // be centrally logged. *NOTE: This is very | ||
77 | // linux/syslog/configuration dependent. | ||
78 | void setElevatedRemote(BOOL b) { mElevatedRemote = b; } | ||
79 | |||
80 | // logs are in utc rather than local | ||
81 | void setUTCTimestamp(BOOL utc); | ||
82 | |||
83 | // Turn on or off logging outputs | ||
84 | void enableError(BOOL active); | ||
85 | void enableErrorTimestamp(BOOL active); | ||
86 | void enableFile(BOOL active); | ||
87 | void enableSyslog(BOOL active); | ||
88 | #if LL_WINDOWS | ||
89 | void enableWinDebug(BOOL active); | ||
90 | #endif // LL_WINDOWS | ||
91 | |||
92 | protected: | ||
93 | int overflow(int c = EOF); | ||
94 | |||
95 | private: | ||
96 | char mFilename[LL_MAX_PATH]; /* Flawfinder: ignore */ | ||
97 | int ELevelToSyslogPriority(const ELevel l); | ||
98 | |||
99 | llofstream *mFile; | ||
100 | std::string mBuf; | ||
101 | LLFixedBuffer *mFixedBuf; | ||
102 | |||
103 | BOOL mErrorActive; | ||
104 | BOOL mErrorTimestamp; | ||
105 | BOOL mFileActive; | ||
106 | BOOL mSyslogActive; | ||
107 | BOOL mWinDebugActive; | ||
108 | BOOL mElevatedRemote; | ||
109 | BOOL mIsUTC; | ||
110 | |||
111 | // If priority < level, output is thrown away | ||
112 | ELevel mLevel; | ||
113 | // Current message priority | ||
114 | ELevel mPriority; | ||
115 | }; | ||
116 | |||
117 | #endif // LL_LLERRORBUFFER_H | ||