Skip to content

Commit d305e29

Browse files
committed
Fix logcat for Windows
1 parent c870a85 commit d305e29

20 files changed

+29
-56
lines changed

Backend/Converter/ChainsawToLogConverter.cs

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ namespace Backend.Converter {
1515
public class ChainsawToLogConverter : ILogConverter {
1616

1717
private ILogger Logger { get; set; }
18-
private string log4j = "http://jakarta.apache.org/log4j";
19-
private string nlog = "http://www.nlog-project.org/schemas/NLog.xsd";
2018

2119
public ChainsawToLogConverter() {
2220
Logger = LogManager.GetCurrentClassLogger();
@@ -36,15 +34,6 @@ public IEnumerable<Log> Convert(string text) {
3634
try {
3735
Log log = new Log();
3836

39-
NameTable nt = new NameTable();
40-
//XmlNamespaceManager mgr = new XmlNamespaceManager(nt);
41-
//mgr.AddNamespace("log4j", log4j);
42-
//mgr.AddNamespace("nlog", nlog);
43-
44-
//XmlParserContext pc = new XmlParserContext(nt, mgr, String.Empty, XmlSpace.Default);
45-
46-
XNamespace log4jNs = log4j;
47-
4837
XmlReaderSettings settings = new XmlReaderSettings() {
4938
ConformanceLevel = ConformanceLevel.Fragment
5039
};
@@ -110,49 +99,8 @@ public IEnumerable<Log> Convert(string text) {
11099
log.Context = String.Join(", ", context);
111100
}
112101
}
113-
114-
//var timespan = TimeSpan.FromMilliseconds((long)eventEl.Attribute("timestamp"));
115-
// log.Timestamp = new DateTime(1970, 1, 1).Add(timespan);
116-
// log.Level = (string)eventEl.Attribute("level");
117-
// log.Message = (string)eventEl.Element(log4jNs + "message");
118-
// log.Exception = (string)eventEl.Element(log4jNs + "throwable");
119-
// log.Namespace = (string)eventEl.Attribute("logger");
120-
// log.Thread = (string)eventEl.Attribute("thread")
121102
}
122103
}
123-
124-
125-
//using (XmlReader xr = XmlReader.Create(stream, settings, pc)) {
126-
// while (xr.Read()) {
127-
// if (xr.NodeType == XmlNodeType.Element && xr.LocalName == "event") {
128-
// using (XmlReader eventReader = xr.ReadSubtree()) {
129-
// eventReader.Read();
130-
// XElement eventEl = XNode.ReadFrom(eventReader) as XElement;
131-
132-
133-
// var timespan = TimeSpan.FromMilliseconds((long)eventEl.Attribute("timestamp"));
134-
// log.Timestamp = new DateTime(1970, 1, 1).Add(timespan);
135-
// log.Level = (string)eventEl.Attribute("level");
136-
// log.Message = (string)eventEl.Element(log4jNs + "message");
137-
// log.Exception = (string)eventEl.Element(log4jNs + "throwable");
138-
// log.Namespace = (string)eventEl.Attribute("logger");
139-
// log.Thread = (string)eventEl.Attribute("thread");
140-
141-
// var props = eventEl.Element(log4jNs + "properties").Elements(log4jNs + "data");
142-
// log.Properties = props.Select(m => new Property(m.Attribute("name").Value, m.Attribute("value").Value));
143-
144-
// var application = log.Properties.FirstOrDefault(m => m.Name == "log4japp");
145-
// log.Application = application == null ? null : application.Value;
146-
147-
// var context = log.Properties.Where(m => !m.Name.StartsWith("log4j")).Select(m => m.Name + ": " + m.Value);
148-
// log.Context = String.Join(", ", context);
149-
150-
// eventReader.Close();
151-
// }
152-
// }
153-
// }
154-
// xr.Close();
155-
//}
156104
return new Log[] { log };
157105
} catch (Exception e) {
158106
Logger.Error(e, "Could not read chainsaw data");

Backend/Converter/LogcatToLogConverter.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ public IEnumerable<Log> Convert(string text) {
2929
}
3030

3131
try {
32-
string[] lines = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
33-
if (lines.Length == 1) {
34-
lines = text.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
35-
}
32+
string[] lines = text.Split(new string[] { "\r\n", "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);
3633

3734
IList<Log> logs = new List<Log>();
3835

Backend/bin/Debug/Backend.dll

0 Bytes
Binary file not shown.

Backend/bin/Debug/Backend.pdb

0 Bytes
Binary file not shown.
Binary file not shown.

Backend/obj/Debug/Backend.dll

0 Bytes
Binary file not shown.

Backend/obj/Debug/Backend.pdb

0 Bytes
Binary file not shown.

Loginator.v12.suo

0 Bytes
Binary file not shown.

Loginator/bin/Debug/Backend.dll

0 Bytes
Binary file not shown.

Loginator/bin/Debug/Backend.pdb

0 Bytes
Binary file not shown.

Loginator/bin/Debug/Loginator.exe

0 Bytes
Binary file not shown.

Loginator/bin/Debug/Loginator.pdb

4 KB
Binary file not shown.

Loginator/bin/Debug/Logs/log.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2015-10-13 09:48:24:966 | Loginator.App | Info | [OnStartup] Application successfully started |
2+
2015-10-13 09:48:25:864 | Loginator.MainWindow | Info | No new version available. Current: '3' |
3+
2015-10-13 09:54:52:934 | Loginator.App | Info | [OnStartup] Application successfully started |
4+
2015-10-13 09:54:53:594 | Loginator.MainWindow | Info | No new version available. Current: '3' |
Binary file not shown.
Binary file not shown.

Loginator/obj/Debug/Loginator.exe

0 Bytes
Binary file not shown.

Loginator/obj/Debug/Loginator.pdb

4 KB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Loginator
2+
3+
4+
winexe
5+
C#
6+
.cs
7+
C:\Users\Daniel\Documents\GitHub\Loginator\Loginator\obj\Debug\
8+
Loginator
9+
none
10+
false
11+
DEBUG;TRACE
12+
C:\Users\Daniel\Documents\GitHub\Loginator\Loginator\App.xaml
13+
2-1483463558
14+
15+
25-41704193
16+
25505523258
17+
ConfigurationWindow.xaml;MainWindow.xaml;
18+
19+
True
20+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
C:\Users\Daniel\Documents\GitHub\Loginator\Loginator\obj\Debug\GeneratedInternalTypeHelper.g.i.cs
2+
FC:\Users\Daniel\Documents\GitHub\Loginator\Loginator\App.xaml;;
3+
FC:\Users\Daniel\Documents\GitHub\Loginator\Loginator\MainWindow.xaml;;
4+
Binary file not shown.

0 commit comments

Comments
 (0)