about summary refs log tree commit diff
path: root/src/log2xml/log2xml.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/log2xml/log2xml.cc')
-rw-r--r--src/log2xml/log2xml.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/log2xml/log2xml.cc b/src/log2xml/log2xml.cc
index 66e182452844..a4955dc6e82d 100644
--- a/src/log2xml/log2xml.cc
+++ b/src/log2xml/log2xml.cc
@@ -16,6 +16,7 @@ struct Decoder
     bool newNumber;
     int priority;
     bool ignoreLF;
+    int lineNo, charNo;
 
     Decoder()
     {
@@ -25,6 +26,8 @@ struct Decoder
         level = 0;
         priority = 1;
         ignoreLF = false;
+        lineNo = 1;
+        charNo = 0;
     }
 
     void pushChar(char c);
@@ -35,6 +38,11 @@ struct Decoder
 
 void Decoder::pushChar(char c)
 {
+    if (c == '\n') {
+        lineNo++;
+        charNo = 0;
+    } else charNo++;
+    
     switch (state) {
         
         case stTop:
@@ -71,7 +79,8 @@ void Decoder::pushChar(char c)
                             level--;
                             cout << "</nest>" << endl;
                         } else
-                            cerr << "not enough nesting levels" << endl;
+                            cerr << "not enough nesting levels at line "
+                                 << lineNo << ", character " << charNo  << endl;
                         break;
                     case 's':
                         if (line.size()) finishLine();