VirtualBox

Changeset 92893 in vbox


Ignore:
Timestamp:
Dec 14, 2021 9:22:24 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148848
Message:

ValKit/testdriver/reporter.py: Get the right caller for maybeErr and maybeLog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/reporter.py

    r92309 r92893  
    14101410#
    14111411
    1412 def log(sText):
     1412def log(sText, sCaller = None):
    14131413    """Writes the specfied text to the log."""
    14141414    g_oLock.acquire();
    14151415    try:
    1416         rc = g_oReporter.log(1, sText, utils.getCallerName(), utils.getTimePrefix());
     1416        rc = g_oReporter.log(1, sText, sCaller if sCaller else utils.getCallerName(), utils.getTimePrefix());
    14171417    except:
    14181418        rc = -1;
     
    14281428    return logXcptWorker(1, False, "", sText, cFrames);
    14291429
    1430 def log2(sText):
     1430def log2(sText, sCaller = None):
    14311431    """Log level 2: Writes the specfied text to the log."""
    14321432    g_oLock.acquire();
    14331433    try:
    1434         rc = g_oReporter.log(2, sText, utils.getCallerName(), utils.getTimePrefix());
     1434        rc = g_oReporter.log(2, sText, sCaller if sCaller else utils.getCallerName(), utils.getTimePrefix());
    14351435    except:
    14361436        rc = -1;
     
    14461446    return logXcptWorker(2, False, "", sText, cFrames);
    14471447
    1448 def log3(sText):
     1448def log3(sText, sCaller = None):
    14491449    """Log level 3: Writes the specfied text to the log."""
    14501450    g_oLock.acquire();
    14511451    try:
    1452         rc = g_oReporter.log(3, sText, utils.getCallerName(), utils.getTimePrefix());
     1452        rc = g_oReporter.log(3, sText, sCaller if sCaller else utils.getCallerName(), utils.getTimePrefix());
    14531453    except:
    14541454        rc = -1;
     
    14641464    return logXcptWorker(3, False, "", sText, cFrames);
    14651465
    1466 def log4(sText):
     1466def log4(sText, sCaller = None):
    14671467    """Log level 4: Writes the specfied text to the log."""
    14681468    g_oLock.acquire();
    14691469    try:
    1470         rc = g_oReporter.log(4, sText, utils.getCallerName(), utils.getTimePrefix());
     1470        rc = g_oReporter.log(4, sText, sCaller if sCaller else utils.getCallerName(), utils.getTimePrefix());
    14711471    except:
    14721472        rc = -1;
     
    14821482    return logXcptWorker(4, False, "", sText, cFrames);
    14831483
    1484 def log5(sText):
     1484def log5(sText, sCaller = None):
    14851485    """Log level 2: Writes the specfied text to the log."""
    14861486    g_oLock.acquire();
    14871487    try:
    1488         rc = g_oReporter.log(5, sText, utils.getCallerName(), utils.getTimePrefix());
     1488        rc = g_oReporter.log(5, sText, sCaller if sCaller else utils.getCallerName(), utils.getTimePrefix());
    14891489    except:
    14901490        rc = -1;
     
    15001500    return logXcptWorker(5, False, "", sText, cFrames);
    15011501
    1502 def log6(sText):
     1502def log6(sText, sCaller = None):
    15031503    """Log level 6: Writes the specfied text to the log."""
    15041504    g_oLock.acquire();
    15051505    try:
    1506         rc = g_oReporter.log(6, sText, utils.getCallerName(), utils.getTimePrefix());
     1506        rc = g_oReporter.log(6, sText, sCaller if sCaller else utils.getCallerName(), utils.getTimePrefix());
    15071507    except:
    15081508        rc = -1;
     
    15211521    """ Maybe error or maybe normal log entry. """
    15221522    if fIsError is True:
    1523         return error(sText);
    1524     return log(sText);
     1523        return error(sText, sCaller = utils.getCallerName());
     1524    return log(sText, sCaller = utils.getCallerName());
    15251525
    15261526def maybeErrXcpt(fIsError, sText=None, cFrames=1):
     
    15331533    """ Maybe error or maybe normal log entry. """
    15341534    if fIsNotError is not True:
    1535         return error(sText);
    1536     return log(sText);
     1535        return error(sText, sCaller = utils.getCallerName());
     1536    return log(sText, sCaller = utils.getCallerName());
    15371537
    15381538def maybeLogXcpt(fIsNotError, sText=None, cFrames=1):
     
    15421542    return logXcpt(sText, cFrames);
    15431543
    1544 def error(sText):
     1544def error(sText, sCaller = None):
    15451545    """
    15461546    Writes the specfied error message to the log.
     
    15541554    try:
    15551555        g_oReporter.testIncErrors();
    1556         g_oReporter.log(0, '** error: %s' % (sText), utils.getCallerName(), utils.getTimePrefix());
     1556        g_oReporter.log(0, '** error: %s' % (sText), sCaller if sCaller else utils.getCallerName(), utils.getTimePrefix());
    15571557    except:
    15581558        pass;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette