Exemplo n.º 1
0
        /* ----------------------------------------------------------------- */
        ///
        /// Log
        ///
        /// <summary>
        /// Puts debug information to the log file.
        /// </summary>
        ///
        /// <param name="src">Service object.</param>
        /// <param name="action">User action.</param>
        /// <param name="method">Method name.</param>
        ///
        /* ----------------------------------------------------------------- */
        public static void Log(this SpoolerService src, Action action,
                               [CallerMemberName] string method = null)
        {
            var prev = src.Status;
            var sw   = Stopwatch.StartNew();

            action();
            src.Put($"[{method}]", $"{prev} -> {src.Status}", $"({sw.Elapsed})");
        }
Exemplo n.º 2
0
 /* ----------------------------------------------------------------- */
 ///
 /// Log
 ///
 /// <summary>
 /// Puts debug information to the log file.
 /// </summary>
 ///
 /// <param name="src">Service object.</param>
 /// <param name="method">Method name.</param>
 ///
 /* ----------------------------------------------------------------- */
 public static void Log(this SpoolerService src,
                        [CallerMemberName] string method = null) => src.Put(
     $"[{method}]",
     $"{nameof(src.Name)}:{src.Name.Quote()}",
     $"{nameof(src.Status)}:{src.Status}",
     $"{nameof(src.DisplayName)}:{src.DisplayName.Quote()}",
     $"{nameof(src.MachineName)}:{src.MachineName.Quote()}",
     $"{nameof(src.CanStop)}:{src.CanStop}",
     $"{nameof(src.Timeout)}:{src.Timeout}"
     );