Exemplo n.º 1
0
    public static AppMsg trace(string title, string msg, int?tpad = null, SeverityLevel?severity = null)
    {
        var titleFmt = tpad.Map(pad => title.PadRight(pad), () => title.PadRight(20));
        var appMsg   = AppMsg.Define($"{titleFmt}: {msg}", severity ?? SeverityLevel.Babble);

        print(appMsg);
        return(appMsg);
    }
Exemplo n.º 2
0
 public static bool require(bool value, string info      = null, [CallerFilePath] string caller = null,
                            [CallerFilePath] string file = null, [CallerLineNumber] int?line    = null)
 => value ? true : throw new AppException(AppMsg.Define($"Invariant failure: {info}", SeverityLevel.Error, caller, file, line));
Exemplo n.º 3
0
 public static AppMsg errorMsg(object content)
 => AppMsg.Define($"{content}", SeverityLevel.Error);
Exemplo n.º 4
0
 public static AppMsg appMsg(object content, SeverityLevel level = SeverityLevel.Info)
 => AppMsg.Define($"{content}", level);
Exemplo n.º 5
0
Arquivo: App.cs Projeto: 0xCM/arrows
 static AppMsg CompleteMsg <T>(ITimeSeries <T> series, Duration runtime)
     where T : struct
 => AppMsg.Define($"Series Id = {series.Id} | Last Term = {series.Observed} | Evolution Time = {runtime.Ms} ms", SeverityLevel.Info);
Exemplo n.º 6
0
 /// <summary>
 /// Writes a named value to standard output
 /// </summary>
 /// <param name="nv">The named vaue to emit</param>
 /// <typeparam name="T">The value type</typeparam>
 public static void show <T>(NamedValue <T> nv)
 {
     print(AppMsg.Define($"{nv}", SeverityLevel.HiliteCL));
 }
Exemplo n.º 7
0
    /// <summary>
    /// Evaluates the expression and writes the result to standard output
    /// </summary>
    /// <param name="fx">The expression to evaluate</param>
    /// <typeparam name="T">The evaluation value type</typeparam>
    public static void show <T>(Expression <Func <T> > fx)
    {
        var nv = fx.Evaluate();

        print(AppMsg.Define($"{nv}", SeverityLevel.HiliteCL));
    }
Exemplo n.º 8
0
 /// <summary>
 /// Emits an information-level message
 /// </summary>
 /// <param name="msg">The message to emit</param>
 /// <param name="caller">The calling member</param>
 public static void inform(object msg, [CallerName] string caller = null, [CallerFile] string file = null, [CallerLine] int?line = null)
 => terminal.WriteMessage(AppMsg.Define(msg?.ToString() ?? string.Empty, SeverityLevel.Info, caller, file, line));
Exemplo n.º 9
0
 /// <summary>
 /// Prints an operation timing message to the console
 /// </summary>
 /// <param name="time">The operation timing</param>
 /// <param name="labelPad">Option label pad width</param>
 public static void print(OpTime time, int?labelPad = null)
 => print(AppMsg.Define(time.Format(labelPad), SeverityLevel.Benchmark));
Exemplo n.º 10
0
 /// <summary>
 /// Emits an error-level message
 /// </summary>
 /// <param name="msg">The message to emit</param>
 /// <param name="host">The declaring type of the member</param>
 /// <param name="caller">The calling member</param>
 public static void error <T>(object msg, T host, [CallerName] string caller = null, [CallerFile] string file = null, [CallerLine] int?line = null)
 => terminal.WriteError(AppMsg.Define(msg?.ToString() ?? string.Empty, SeverityLevel.Error, $"{label<T>()}/{caller}", file, line));
Exemplo n.º 11
0
 /// <summary>
 /// Emits an information-level message with a cyan foreground
 /// </summary>
 /// <param name="msg">The message to emit</param>
 /// <param name="caller">The calling member</param>
 public static void cyan(object msg)
 => terminal.WriteMessage(AppMsg.Define(msg?.ToString() ?? string.Empty, SeverityLevel.HiliteCL));
Exemplo n.º 12
0
 /// <summary>
 /// Emits an information-level message with a magenta foreground
 /// </summary>
 /// <param name="msg">The message to emit</param>
 /// <param name="caller">The calling member</param>
 public static void magenta(string title, object msg)
 => terminal.WriteMessage(AppMsg.Define($"{title}: " + msg?.ToString() ?? string.Empty, SeverityLevel.HiliteML));
Exemplo n.º 13
0
 /// <summary>
 /// Emits a highlighted information-level message
 /// </summary>
 /// <param name="msg">The message to emit</param>
 /// <param name="caller">The calling member</param>
 public static void hilite(object msg, SeverityLevel?level = null, [CallerName] string caller = null, [CallerFile] string file = null, [CallerLine] int?line = null)
 => terminal.WriteMessage(AppMsg.Define(msg?.ToString() ?? string.Empty, level ?? SeverityLevel.HiliteBL, caller, file, line));
Exemplo n.º 14
0
Arquivo: FsmES.cs Projeto: 0xCM/arrows
 public ReceiptLimitExceeded(string machine, ulong limit)
     : base(AppMsg.Define($"{machine} Event receipt limit of {limit} was exeeded", SeverityLevel.Warning))
 {
 }