Skip to content

Commit

Permalink
lidoTool: update logging to state of art from mpapi
Browse files Browse the repository at this point in the history
  • Loading branch information
mokko committed Jun 17, 2024
1 parent a808db2 commit fe77488
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
12 changes: 2 additions & 10 deletions zml2lido/data/xsl/zml2lido/inscriptions.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<xsl:attribute name="lido:type">
<xsl:value-of select="$type"/>
</xsl:attribute>

<xsl:comment>
For SMB, inscriptions can be external or internal to the object as determined
by type.
Expand Down Expand Up @@ -211,9 +212,6 @@
-->
<xsl:template match="z:dataField[@name='LabelClb']/z:value">
<lido:inscriptionTranscription lido:label="Aufschrift">
<xsl:variable name="type" select="../../z:vocabularyReference[
@name='TypeVoc'
]/z:vocabularyReferenceItem/z:formattedValue"/>
<xsl:variable name="lang" select="../../z:vocabularyReference[
@name='LanguageVoc'
]/z:vocabularyReferenceItem/z:formattedValue"/>
Expand All @@ -228,12 +226,6 @@
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="$type ne ''">
<xsl:attribute name="lido:type">
<!-- Allg. Angabe Beschriftung -->
<xsl:value-of select="$type"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="."/>
</lido:inscriptionTranscription>
</xsl:template>
Expand All @@ -244,7 +236,7 @@
<xsl:text>sorttest2: </xsl:text>
<xsl:value-of select="$sortorder"/>
</xsl:message-->
<lido:inscriptions lido:label="Transliteration">
<lido:inscriptions lido:type="Transliteration">
<xsl:if test="$sortorder ne ''">
<xsl:attribute name="lido:sortorder">
<xsl:value-of select="$sortorder"/>
Expand Down
15 changes: 11 additions & 4 deletions zml2lido/lidoTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
currently not used/tested.
"""

import datetime
import logging
from lxml import etree
from pathlib import Path
import logging
import os
import re
from saxonche import PySaxonProcessor
Expand Down Expand Up @@ -370,11 +371,17 @@ def _analyze_chunkFn(self, *, src: str | Path) -> tuple[str, int, str]:
return root, no, tail

def _initLog(self) -> None:
logfile = self.outdir / "lidoTool.log"
now = datetime.datetime.now()
date = now.strftime("%Y%m%d")
log_fn = self.outdir / f"lidoTool{date}.log"

# let's append to the log file so we can aggregrate results from multiple runs
logging.basicConfig(
filename=logfile, filemode="a", encoding="utf-8", level=logging.INFO
datefmt="%Y%m%d %I:%M:%S %p",
filename=log_fn,
filemode="a", # append now since we're starting a new folder
encoding="utf-8",
level=logging.DEBUG,
format="%(asctime)s: %(message)s",
)

def _lvl2_path(self, p: str | Path) -> Path:
Expand Down
2 changes: 1 addition & 1 deletion zml2lido/relWorksCache.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def lookup_from_lido_file(self, *, path: Path) -> None:
Should we check that we don't process a lido lvl2 file that has already
been processed?
"""
print(f"relWorksCache: lookup_from_lido_file")
print(f"relWorksCache: lookup_from_lido_file {path}")
IDs = self._lido_to_ids(path=path)
for mtype, id_int in IDs:
self.lookup_relWork(mtype=mtype, ID=id_int)
Expand Down

0 comments on commit fe77488

Please sign in to comment.