summaryrefslogtreecommitdiff
path: root/libfrontend-elements/frontend-elements/diagnostic.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libfrontend-elements/frontend-elements/diagnostic.cxx')
-rw-r--r--libfrontend-elements/frontend-elements/diagnostic.cxx41
1 files changed, 41 insertions, 0 deletions
diff --git a/libfrontend-elements/frontend-elements/diagnostic.cxx b/libfrontend-elements/frontend-elements/diagnostic.cxx
new file mode 100644
index 0000000..c99061f
--- /dev/null
+++ b/libfrontend-elements/frontend-elements/diagnostic.cxx
@@ -0,0 +1,41 @@
+// file : frontend-elements/diagnostic.cxx
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2005-2010 Boris Kolpackov
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include <frontend-elements/diagnostic.hxx>
+
+#include <iostream>
+
+namespace FrontendElements
+{
+ namespace Diagnostic
+ {
+ using std::cerr;
+ using std::endl;
+
+ Log& Log::
+ operator<< (Record const& r)
+ {
+ cerr << r.file () << ":" << r.line ();
+
+ if (r.char_p ()) cerr << ":" << r.char_ ();
+
+ cerr << ": ";
+
+ r.kind ().print (cerr);
+
+ cerr << ": " << r.text () << endl;
+
+ return *this;
+ }
+
+ Log& Log::
+ instance ()
+ {
+ static Log l;
+ return l;
+ }
+ }
+}
+