// these methods are non-static, so that delegate comparisons to them work. protected void doNothing() { if (alwaysFalse()) { LogC.info("I'm doing nothing with " + this); // hide from static method suggestion } }
public static void Init() { try { Directory.CreateDirectory(@"C:\logs"); LogC.makeOld(TRACE_FILE_NAME); } catch { LogC.info("Cannot makeOld logfile (might be locked): " + TRACE_FILE_NAME, false); } JvmLoader.RegisterConfigurationHook(ConfigMethod); }
void acquireTestLock() { while (O.trueDat()) { var otherLock = db.TestLocksTable.TEST_LOCK.tryAcquireLockOnce("test", GetType().FullName); if (otherLock.Equals(db.TestLocksTable.NONE)) { return; } LogC.info("waiting for test lock " + otherLock); O.sleep(350); } }
public static T condensedSql <T>(string s, Creator <T> result) { var debugState = Log.debugSql(); try { Log.doNotDebugSqlForever(); LogC.info(s); Log.info(s); return(result()); } finally { Log.setDebugSqlStateForever(debugState); } }
public void runTimers(DateTime time) { Bomb.unless(time.CompareTo(lastTestTimeRun) > 0, () => "attempting to run timers backwards or rerun the same time, \nlastTestTimeRun is " + ymdHuman(lastTestTimeRun) + "\nthis time: " + ymdHuman(time)); freezeNow(time); LogC.info("run " + Bomb.missing(allowedTimes, time) + " timers " + ymdHuman(time)); var actions = copy(timers.get(time)); timers.remove(time); allowedTimes.Remove(time); Bomb.when(isEmpty(actions), () => "no timers expecting to run on " + ymdHuman(time)); each(actions, action => action()); lastTestTimeRun = time; }
public static string report(string description) { if (get(description).iterations == 0) { return(""); } var result = description + " - total millis: " + toShortString(millis(description)) + ", " + get(description).iterations + "x" + toShortString(millisPer(description)); if (memory) { result += " bytesUsed: " + toShortString(bytesUsed(description)) + ", x" + toShortString(bytesUsedPer(description)); } LogC.info(result); return(result); }
[SetUp] public void setUpWithTeardown() { try { LogC.consoleOut("setUpWithTeardown"); LogC.setOut("setup " + this, null, false); LogC.setVerboseLoggingForever(true); LogC.info("Starting " + this); Log.info("Starting " + this); setUp(); } catch { try { tearDown(); } catch (Exception e) { LogC.err("failed in teardown after failing in setup! ", e); } throw; } }
public static bool isEnvSet(string key, bool defalt) { var human = Environment.GetEnvironmentVariable(key); if (isEmpty(human)) { if (!envNotified.ContainsKey(key)) { LogC.info("ENV: " + key + "=" + defalt + "(default)"); envNotified.Add(key, 1); } return(defalt); } if (!envNotified.ContainsKey(key)) { LogC.info("ENV: " + key + "=" + human); envNotified.Add(key, 1); } return(Strings.toBoolean(human, defalt)); }
public static void info(string s) { LogC.info(s); }