OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os, re | 5 import os, re |
6 from autotest_lib.client.bin.chromeos_constants import CLEANUP_LOGS_PAUSED_FILE | |
7 from autotest_lib.client.common_lib import error, utils | 6 from autotest_lib.client.common_lib import error, utils |
| 7 from autotest_lib.client.cros.constants import CLEANUP_LOGS_PAUSED_FILE |
8 | 8 |
9 class LogReader(object): | 9 class LogReader(object): |
10 """ | 10 """ |
11 A class to read system log files. | 11 A class to read system log files. |
12 """ | 12 """ |
13 | 13 |
14 def __init__(self, filename='/var/log/messages'): | 14 def __init__(self, filename='/var/log/messages'): |
15 self._start_line = 1 | 15 self._start_line = 1 |
16 self._filename = filename | 16 self._filename = filename |
17 if not os.path.exists(CLEANUP_LOGS_PAUSED_FILE): | 17 if not os.path.exists(CLEANUP_LOGS_PAUSED_FILE): |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 """ | 71 """ |
72 return utils.system_output('tail -n +%d %s' % | 72 return utils.system_output('tail -n +%d %s' % |
73 (self._start_line, self._filename)) | 73 (self._start_line, self._filename)) |
74 | 74 |
75 def can_find(self, string): | 75 def can_find(self, string): |
76 """ Try to find string in the logs. | 76 """ Try to find string in the logs. |
77 | 77 |
78 @return boolean indicating if we found the string. | 78 @return boolean indicating if we found the string. |
79 """ | 79 """ |
80 return string in self.get_logs() | 80 return string in self.get_logs() |
OLD | NEW |