Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/DefaultLogSystem.cpp

Issue 10524054: Rename ErrorCallback into LogSystem, provide a proper console API (Closed)
Patch Set: Created May 10, 2013, 2:01 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/DefaultLogSystem.cpp
===================================================================
rename from src/DefaultErrorCallback.cpp
rename to src/DefaultLogSystem.cpp
--- a/src/DefaultErrorCallback.cpp
+++ b/src/DefaultLogSystem.cpp
@@ -11,14 +11,35 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
-#include <AdblockPlus/DefaultErrorCallback.h>
+#include <AdblockPlus/DefaultLogSystem.h>
-void AdblockPlus::DefaultErrorCallback::operator()(const std::string& message)
+void AdblockPlus::DefaultLogSystem::operator()(AdblockPlus::LogSystem::LogLevel logLevel,
+ const std::string& message, const std::string& source)
{
- std::cerr << "Error: " << message << std::endl;
+ switch (logLevel)
+ {
+ case TRACE:
+ std::cerr << "Traceback:" << std::endl;
+ break;
+ case LOG:
+ break;
+ case INFO:
+ std::cerr << "Info: ";
+ break;
+ case WARN:
+ std::cerr << "Warning: ";
+ break;
+ case ERROR:
+ std::cerr << "Error: ";
+ break;
+ }
+ std::cerr << message;
+ if (source.size())
+ std::cerr << " at " << source;
+ std::cerr << std::endl;
}

Powered by Google App Engine
This is Rietveld