private string FormatStoredProcEntry()
        {
            var fullFormat  = "CALL {0} {1}  -- @{2} ms {3}, {4} ";
            var strParams   = LoggingExtensions.FormatSqlParameters(_command.Parameters, "{1}" /*Value only*/, ", ", maxValueLen: 50);
            var strRowCount = (RowCount < 0) ? string.Empty : Util.SafeFormat(", {0} row(s)", RowCount);
            var strDateTime = base.CreatedOn.ToString("[yyyy/MM/dd HH:mm:ss]");
            var result      = Util.SafeFormat(fullFormat, _command.CommandText, strParams, ExecutionTime, strRowCount, strDateTime);

            return(result);
        }
Example #2
0
        private string FormatStoredProcEntry()
        {
            if (string.IsNullOrWhiteSpace(_procCallFormat) || !_procCallFormat.Contains("{0}"))
            {
                _procCallFormat = "{0} {1}";
            }
            var fullFormat  = _procCallFormat + " -- @{2} ms {3}, {4} "; //exec time, row count, datetime
            var strParams   = LoggingExtensions.FormatSqlParameters(_command.Parameters, "{1}" /*Value only*/, ", ", maxValueLen: 50);
            var strRowCount = (RowCount < 0) ? string.Empty : StringHelper.SafeFormat(", {0} row(s)", RowCount);
            var strDateTime = _dateTime.ToString("[yyyy/MM/dd HH:mm:ss]");
            var result      = StringHelper.SafeFormat(fullFormat, _command.CommandText, strParams, ExecutionTime, strRowCount, strDateTime);

            return(result);
        }
Example #3
0
        private string FormatSqlEntry()
        {
            const string fullFormat = "{0} \r\n{1} -- Time {2} ms{3}, {4} \r\n"; //sql, params, exec time, row count, datetime
            var          fParams    = string.Empty;

            if (_command.Parameters.Count > 0)
            {
                var strParams = LoggingExtensions.FormatSqlParameters(_command.Parameters, "{0}={1}", ", ", maxValueLen: 50);
                fParams = StringHelper.SafeFormat("-- Parameters: {0} \r\n", strParams);
            }
            var strRowCount = (RowCount < 0) ? string.Empty : StringHelper.SafeFormat("; {0} row(s)", RowCount);
            var strDateTime = _dateTime.ToString("[yyyy/MM/dd HH:mm:ss]");
            var result      = StringHelper.SafeFormat(fullFormat, _command.CommandText, fParams, ExecutionTime, strRowCount, strDateTime);

            return(result);
        }