public static Log make(string name, bool register) { Log self = new Log(); make_(self, name, register); return self; }
public static void make_(Log self, string name, bool register) { // verify valid name Uri.checkName(name); self.m_name = name; if (register) { lock (lockObj) { // verify unique if (byName[name] != null) throw ArgErr.make("Duplicate log name: " + name).val; // init and put into map byName[name] = self; // check for initial level string val = (string)Sys.m_sysPod.props(Uri.fromStr("log.props"), Duration.m_oneMin).get(name); if (val != null) self.m_level = LogLevel.fromStr(val); } } }
////////////////////////////////////////////////////////////////////////// // Construction ////////////////////////////////////////////////////////////////////////// public static List list() { lock (lockObj) { Log[] arr = new Log[byName.Count]; byName.Values.CopyTo(arr, 0); return new List(Sys.LogType, arr).ro(); } }