Improve logging.
This commit is contained in:
parent
eae8cb718b
commit
f199b2f1bf
@ -103,6 +103,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
// "HBs-Antigen: neg. ;"
|
||||
// "Erythrozyten (U): + [negativ]"
|
||||
Match match;
|
||||
Logger.Debug("ParseLauris: {0}", LaurisText);
|
||||
if (_numericalRegex.IsMatch(LaurisText))
|
||||
{
|
||||
Logger.Debug("ParseLauris: Numerical match");
|
||||
@ -139,10 +140,11 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
{
|
||||
if (match.Groups["limits"].Success)
|
||||
{
|
||||
Logger.Debug("ParseLimits: Has limits");
|
||||
Logger.Debug("ParseLimits: Has limits: {0}", match.Groups["limits"].Value);
|
||||
Match limitMatch = _limitRegex.Match(match.Groups["limits"].Value);
|
||||
if (limitMatch.Groups["limit1"].Success && limitMatch.Groups["limit2"].Success)
|
||||
{
|
||||
Logger.Debug("ParseLimits: Upper and lower limit detected");
|
||||
// Use InvariantCulture because Lauris always outputs dots as decimal separator
|
||||
// Only in rare cases, a comma sneaks in...
|
||||
LowerLimit = Double.Parse(limitMatch.Groups["limit1"].Value.Replace(',', '.'),
|
||||
@ -152,6 +154,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Debug("ParseLimits: Single limit detected");
|
||||
switch (limitMatch.Groups["operator"].Value.Trim())
|
||||
{
|
||||
case "<=":
|
||||
@ -167,9 +170,9 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
// Fixes exception ID 65ca8575.
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException(
|
||||
String.Format("Unknown operator in {0}",
|
||||
match.Groups["limits"].Value));
|
||||
string unknown = match.Groups["limits"].Value;
|
||||
Logger.Fatal("ParseLimits: Unknown operator \"{0}\"", unknown);
|
||||
throw new InvalidOperationException(String.Format("Unknown operator in {0}",unknown));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
/// </summary>
|
||||
void Parse()
|
||||
{
|
||||
Logger.Info("Parse: \"{0}\"", OriginalParagraph.TruncateWithEllipsis(40));
|
||||
Match m = _expectedFormat.Match(OriginalParagraph);
|
||||
if (m.Success)
|
||||
{
|
||||
@ -130,7 +131,6 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
else
|
||||
{
|
||||
Logger.Info("Parse: Does not match Lauris paragraph format");
|
||||
Logger.Info("Parse: {0}", OriginalParagraph.TruncateWithEllipsis(40));
|
||||
IsLaurisParagraph = false;
|
||||
}
|
||||
}
|
||||
|
@ -219,12 +219,12 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
// the normal format of a paragraph generated from Lauris.
|
||||
if (m.Groups["tail"].Success)
|
||||
{
|
||||
Logger.Debug("ParseParagraph: Time stamp has tail, adding dummy caption");
|
||||
Logger.Info("ParseParagraph: Time stamp has a tail -- putting it back with a dummy caption");
|
||||
paragraph = "DUMMY CAPTION: " + m.Groups["tail"].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
paragraph = String.Empty;
|
||||
paragraph = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,17 +67,19 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
/// <param name="text">ZAA-formatted Lauris output to import.</param>
|
||||
public void Import(string text)
|
||||
{
|
||||
Logger.Info("Import");
|
||||
Logger.Info("Import: \"{0}\"", text.TruncateWithEllipsis(120));
|
||||
string[] paragraphs = Helpers.SplitParagraphs(text);
|
||||
Logger.Info("Import: {0} paragraph(s)", paragraphs.Length);
|
||||
LaurisTimePoint timePoint = null;
|
||||
|
||||
foreach (string paragraph in paragraphs)
|
||||
{
|
||||
Logger.Info("Import: \"{0}\"", paragraph.TruncateWithEllipsis(40));
|
||||
// If the current paragraph looks like a Lauris time stamp,
|
||||
// create a new time point.
|
||||
if (LaurisTimePoint.IsTimeStampLine(paragraph))
|
||||
{
|
||||
Logger.Info("Import: Time stamp line: {0}", paragraph);
|
||||
Logger.Info("Import: Time stamp detected", paragraph);
|
||||
timePoint = new LaurisTimePoint(paragraph, _parameters, _units);
|
||||
// Add the time point to the laboratory only if none
|
||||
// with the same time stamp exists yet.
|
||||
@ -106,8 +108,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Debug("Import: Neither time line, nor Lauris paragraph");
|
||||
Logger.Debug("Import: {0}", paragraph.TruncateWithEllipsis(30));
|
||||
Logger.Debug("Import: Neither time stamp, nor Lauris paragraph");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user