3535from test .framework .utilities import EnhancedTestCase , TestLoaderFiltered
3636from unittest import TextTestRunner
3737
38- from easybuild .base .fancylogger import getLogger , getRootLoggerName , logToFile , setLogFormat
38+ from easybuild .base .fancylogger import getLogger , logToFile , setLogFormat
3939from easybuild .tools .build_log import LOGGING_FORMAT , EasyBuildError , EasyBuildLog , dry_run_msg , dry_run_warning
4040from easybuild .tools .build_log import init_logging , print_error , print_msg , print_warning , stop_logging , time_str_since
4141from easybuild .tools .filetools import read_file , write_file
@@ -68,7 +68,7 @@ def test_easybuilderror(self):
6868 self .assertErrorRegex (EasyBuildError , 'BOOM' , raise_easybuilderror , 'BOOM' )
6969 logToFile (tmplog , enable = False )
7070
71- log_re = re .compile ("^%s ::.* BOOM \(at .*:[0-9]+ in [a-z_]+\)$" % getRootLoggerName () , re .M )
71+ log_re = re .compile ("^root ::.* BOOM \(at .*:[0-9]+ in [a-z_]+\)$" , re .M )
7272 logtxt = open (tmplog , 'r' ).read ()
7373 self .assertTrue (log_re .match (logtxt ), "%s matches %s" % (log_re .pattern , logtxt ))
7474
@@ -130,19 +130,17 @@ def test_easybuildlog(self):
130130 logToFile (tmplog , enable = False )
131131 logtxt = read_file (tmplog )
132132
133- root = getRootLoggerName ()
134-
135133 expected_logtxt = '\n ' .join ([
136- r"%s .test_easybuildlog \[DEBUG\] :: 123 debug" % root ,
137- r"%s .test_easybuildlog \[INFO\] :: foobar info" % root ,
138- r"%s .test_easybuildlog \[WARNING\] :: justawarning" % root ,
139- r"%s .test_easybuildlog \[WARNING\] :: Deprecated functionality.*anotherwarning.*" % root ,
140- r"%s .test_easybuildlog \[WARNING\] :: Deprecated functionality.*onemorewarning.*" % root ,
141- r"%s .test_easybuildlog \[WARNING\] :: Deprecated functionality.*lastwarning.*" % root ,
142- r"%s .test_easybuildlog \[WARNING\] :: Deprecated functionality.*thisisnotprinted.*" % root ,
143- r"%s .test_easybuildlog \[ERROR\] :: EasyBuild crashed with an error \(at .* in .*\): kaput" % root ,
144- root + r" .test_easybuildlog \[ERROR\] :: EasyBuild crashed with an error \(at .* in .*\): err: msg: %s" ,
145- r"%s .test_easybuildlog \[ERROR\] :: .*EasyBuild encountered an exception \(at .* in .*\): oops" % root ,
134+ r"root .test_easybuildlog \[DEBUG\] :: 123 debug" ,
135+ r"root .test_easybuildlog \[INFO\] :: foobar info" ,
136+ r"root .test_easybuildlog \[WARNING\] :: justawarning" ,
137+ r"root .test_easybuildlog \[WARNING\] :: Deprecated functionality.*anotherwarning.*" ,
138+ r"root .test_easybuildlog \[WARNING\] :: Deprecated functionality.*onemorewarning.*" ,
139+ r"root .test_easybuildlog \[WARNING\] :: Deprecated functionality.*lastwarning.*" ,
140+ r"root .test_easybuildlog \[WARNING\] :: Deprecated functionality.*thisisnotprinted.*" ,
141+ r"root .test_easybuildlog \[ERROR\] :: EasyBuild crashed with an error \(at .* in .*\): kaput" ,
142+ r"root .test_easybuildlog \[ERROR\] :: EasyBuild crashed with an error \(at .* in .*\): err: msg: %s" ,
143+ r"root .test_easybuildlog \[ERROR\] :: .*EasyBuild encountered an exception \(at .* in .*\): oops" ,
146144 '' ,
147145 ])
148146 logtxt_regex = re .compile (r'^%s' % expected_logtxt , re .M )
@@ -165,10 +163,10 @@ def test_easybuildlog(self):
165163 logToFile (tmplog , enable = False )
166164 logtxt = read_file (tmplog )
167165 expected_logtxt = '\n ' .join ([
168- r"%s .test_easybuildlog \[WARNING\] :: bleh" % root ,
169- r"%s .test_easybuildlog \[INFO\] :: 4\+2 = 42" % root ,
170- r"%s .test_easybuildlog \[DEBUG\] :: this is just a test" % root ,
171- r"%s .test_easybuildlog \[ERROR\] :: EasyBuild crashed with an error \(at .* in .*\): foo baz baz" % root ,
166+ r"root .test_easybuildlog \[WARNING\] :: bleh" ,
167+ r"root .test_easybuildlog \[INFO\] :: 4\+2 = 42" ,
168+ r"root .test_easybuildlog \[DEBUG\] :: this is just a test" ,
169+ r"root .test_easybuildlog \[ERROR\] :: EasyBuild crashed with an error \(at .* in .*\): foo baz baz" ,
172170 '' ,
173171 ])
174172 logtxt_regex = re .compile (r'^%s' % expected_logtxt , re .M )
@@ -217,9 +215,7 @@ def test_log_levels(self):
217215 logToFile (tmplog , enable = False )
218216 logtxt = read_file (tmplog )
219217
220- root = getRootLoggerName ()
221-
222- prefix = '%s.test_easybuildlog' % root
218+ prefix = 'root.test_easybuildlog'
223219 devel_msg = r"%s \[DEVEL\] :: tmi" % prefix
224220 debug_msg = r"%s \[DEBUG\] :: gdb" % prefix
225221 info_msg = r"%s \[INFO\] :: fyi" % prefix
0 commit comments