diff options
author | skilchen <skilchen@users.noreply.github.com> | 2017-12-11 14:43:59 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-12-11 14:43:59 +0100 |
commit | 28e0bf9dcd62f387c79f767848cadd8b71d825de (patch) | |
tree | baa7a7b695391185bd3d355e8ad22a6a8d07c262 /lib | |
parent | 6e08ae5c266a044269e750c77b487a4a23e57690 (diff) | |
download | Nim-28e0bf9dcd62f387c79f767848cadd8b71d825de.tar.gz |
fix #6264 and #6141 (#6884)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/logging.nim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pure/logging.nim b/lib/pure/logging.nim index e2a5bed96..830820fd1 100644 --- a/lib/pure/logging.nim +++ b/lib/pure/logging.nim @@ -202,13 +202,17 @@ when not defined(js): proc countLogLines(logger: RollingFileLogger): int = result = 0 - for line in logger.file.lines(): + let fp = open(logger.baseName, fmRead) + for line in fp.lines(): result.inc() + fp.close() proc countFiles(filename: string): int = # Example: file.log.1 result = 0 - let (dir, name, ext) = splitFile(filename) + var (dir, name, ext) = splitFile(filename) + if dir == "": + dir = "." for kind, path in walkDir(dir): if kind == pcFile: let llfn = name & ext & ExtSep |