diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-10-20 20:51:59 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-10-20 20:51:59 +0000 |
commit | 6e106a2cc52e3857cbd55d67d54b4589f3425c51 (patch) | |
tree | 370dbdcd1f4c2b047b183387c052a339c25e8591 /src/logger.cpp | |
parent | addca63bba3ddaf212e44cdf16e95038b0a5bf3e (diff) | |
download | libbu++-6e106a2cc52e3857cbd55d67d54b4589f3425c51.tar.gz libbu++-6e106a2cc52e3857cbd55d67d54b4589f3425c51.tar.bz2 libbu++-6e106a2cc52e3857cbd55d67d54b4589f3425c51.tar.xz libbu++-6e106a2cc52e3857cbd55d67d54b4589f3425c51.zip |
Made the logger use a uint32_t for it's mask, no more negative confusion. Also
brought back the formula class with some cool twists, and added a basic stack
class, very cute, fast, and little.
Diffstat (limited to '')
-rw-r--r-- | src/logger.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/logger.cpp b/src/logger.cpp index 8c058d1..fe6a916 100644 --- a/src/logger.cpp +++ b/src/logger.cpp | |||
@@ -12,7 +12,7 @@ Bu::Logger::~Logger() | |||
12 | { | 12 | { |
13 | } | 13 | } |
14 | 14 | ||
15 | void Bu::Logger::log( int nLevel, const char *sFile, const char *sFunction, int nLine, const char *sFormat, ...) | 15 | void Bu::Logger::log( uint32_t nLevel, const char *sFile, const char *sFunction, int nLine, const char *sFormat, ...) |
16 | { | 16 | { |
17 | if( (nLevel&nLevelMask) == 0 ) | 17 | if( (nLevel&nLevelMask) == 0 ) |
18 | return; | 18 | return; |
@@ -112,12 +112,17 @@ void Bu::Logger::setFormat( const Bu::FString &str ) | |||
112 | //write( fileno(stdout), sLogFormat.getStr(), sLogFormat.getSize() ); | 112 | //write( fileno(stdout), sLogFormat.getStr(), sLogFormat.getSize() ); |
113 | } | 113 | } |
114 | 114 | ||
115 | void Bu::Logger::setMask( int n ) | 115 | void Bu::Logger::setMask( uint32_t n ) |
116 | { | 116 | { |
117 | nLevelMask = n; | 117 | nLevelMask = n; |
118 | } | 118 | } |
119 | 119 | ||
120 | void Bu::Logger::setLevel( int n ) | 120 | uint32_t Bu::Logger::getMask() |
121 | { | ||
122 | return nLevelMask; | ||
123 | } | ||
124 | |||
125 | void Bu::Logger::setLevel( uint32_t n ) | ||
121 | { | 126 | { |
122 | int j; | 127 | int j; |
123 | for( j = 31; j > 0; j-- ) | 128 | for( j = 31; j > 0; j-- ) |
@@ -134,8 +139,8 @@ void Bu::Logger::setLevel( int n ) | |||
134 | } | 139 | } |
135 | } | 140 | } |
136 | 141 | ||
137 | void Bu::Logger::hexDump( int nLevel, const char *sFile, const char *sFunction, | 142 | void Bu::Logger::hexDump( uint32_t nLevel, const char *sFile, |
138 | int nLine, const void *pDataV, long nDataLen, | 143 | const char *sFunction, int nLine, const void *pDataV, long nDataLen, |
139 | const char *lpName ) | 144 | const char *lpName ) |
140 | { | 145 | { |
141 | log( nLevel, sFile, sFunction, nLine, "Displaying %ld bytes of %s.", nDataLen, lpName ); | 146 | log( nLevel, sFile, sFunction, nLine, "Displaying %ld bytes of %s.", nDataLen, lpName ); |
@@ -176,3 +181,4 @@ void Bu::Logger::hexDump( int nLevel, const char *sFile, const char *sFunction, | |||
176 | } | 181 | } |
177 | log( nLevel, sFile, sFunction, nLine, sBorder.getStr() ); | 182 | log( nLevel, sFile, sFunction, nLine, sBorder.getStr() ); |
178 | } | 183 | } |
184 | |||