aboutsummaryrefslogtreecommitdiffstats
path: root/common.py
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-04-23 17:28:12 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2013-04-23 17:28:12 -0400
commit2ceaa6c607ef85bde4f14017634d9d1621efca29 (patch)
treec85e755e59907a48ff762fd56473449f33c23894 /common.py
parenta0e4b9fe9d7fab9a50a626cfeda3c614a9a6af5d (diff)
parent7545402506aa76261e18d85af585ff0ac1cf05c1 (diff)
Merge branch 'master' into wip-color-mc
Conflicts: gen/generator.py parse/sched.py parse_exps.py
Diffstat (limited to 'common.py')
-rw-r--r--common.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/common.py b/common.py
index a2c6224..7abf0f2 100644
--- a/common.py
+++ b/common.py
@@ -193,3 +193,20 @@ def is_device(dev):
193 return False 193 return False
194 mode = os.stat(dev)[stat.ST_MODE] 194 mode = os.stat(dev)[stat.ST_MODE]
195 return not (not mode & stat.S_IFCHR) 195 return not (not mode & stat.S_IFCHR)
196
197__logged = []
198
199def set_logged_list(logged):
200 global __logged
201 __logged = logged
202
203def log_once(id, msg = None, indent = True):
204 global __logged
205
206 msg = msg if msg else id
207
208 if id not in __logged:
209 __logged += [id]
210 if indent:
211 msg = ' ' + msg.strip('\t').replace('\n', '\n\t')
212 sys.stderr.write('\n' + msg.strip('\n') + '\n')