diff --git a/docs/io/LogReader.md b/docs/io/LogReader.md index f51821dd94bed58d79461a1ede976edd3b18e847..d433e6b0fe61f8312ba24e8c5891455dcb217e80 100644 --- a/docs/io/LogReader.md +++ b/docs/io/LogReader.md @@ -5,7 +5,7 @@ VisualDL可通过LogReader获取保存的日志中所有数据,帮助用户进 ## LogReader主要方法说明 -### __init__(file_name) +### __init__(file_path) #### 功能 @@ -15,7 +15,7 @@ VisualDL可通过LogReader获取保存的日志中所有数据,帮助用户进 | 参数 | 格式 | 含义 | | --------------- | ------- | ------------------------------------------------------------ | -| file_name | string | 指定要读的日志文件路径,必填| +| file_path | string | 指定要读的日志文件路径,必填,注意这里与file_name不同,需填写具体路径| #### 示例 @@ -24,7 +24,7 @@ VisualDL可通过LogReader获取保存的日志中所有数据,帮助用户进 ```python from visualdl import LogReader -reader = LogReader(file_name='./log/vdlrecords.1605533348.log') +reader = LogReader(file_path='./log/vdlrecords.1605533348.log') ``` ### get_tags() diff --git a/visualdl/reader/reader.py b/visualdl/reader/reader.py index 72d27b316028b350fb0c5a52ecf06973239a414c..2d1fcc7333809ecd4dd7174b858a830be70e0076 100644 --- a/visualdl/reader/reader.py +++ b/visualdl/reader/reader.py @@ -41,7 +41,7 @@ class LogReader(object): """ - def __init__(self, logdir='', file_name=''): + def __init__(self, logdir='', file_path=''): """Instance of LogReader Args: @@ -61,9 +61,9 @@ class LogReader(object): self.file_readers = {} - if file_name: + if file_path: self._log_data = collections.defaultdict(lambda: collections.defaultdict(list)) - self.get_file_reader(file_name=file_name) + self.get_file_reader(file_path=file_path) remain = self.get_remain() self.read_log_data(remain=remain) @@ -203,17 +203,17 @@ class LogReader(object): self.reader = self.readers[filepath] return self.reader - def get_file_reader(self, file_name): + def get_file_reader(self, file_path): """Get file reader for specified vdl log file. Get instance of class RecordReader base on BFile. Args: - file_name: Vdl log file name. + file_path: Vdl log file path. """ - self._register_reader(file_name) - self.reader = self.readers[file_name] - self.reader.dir = file_name + self._register_reader(file_path) + self.reader = self.readers[file_path] + self.reader.dir = file_path return self.reader def _register_reader(self, path, dir=None):