/// <summary> Log a IDbCommand. </summary> /// <param name="message">Title</param> /// <param name="command">The SQL statement. </param> /// <param name="style">The requested formatting style. </param> public virtual void LogCommand(string message, IDbCommand command, FormatStyle style) { if (!log.IsDebugEnabled && !LogToStdout || string.IsNullOrEmpty(command.CommandText)) { return; } style = DetermineActualStyle(style); string statement = style.Formatter.Format(GetCommandLineWithParameters(command)); string logMessage; if (string.IsNullOrEmpty(message)) { logMessage = statement; } else { logMessage = message + statement; } log.Debug(logMessage); if (LogToStdout) { Console.Out.WriteLine("NHibernate: " + statement); } }
/// <summary> Log a DbCommand. </summary> /// <param name="command">The SQL statement. </param> /// <param name="style">The requested formatting style. </param> public virtual void LogCommand(DbCommand command, FormatStyle style) { LogCommand(null, command, style); }
public FormatStyle DetermineActualStyle(FormatStyle style) { return(FormatSql ? style : FormatStyle.None); }
/// <summary> Log a IDbCommand. </summary> /// <param name="command">The SQL statement. </param> /// <param name="style">The requested formatting style. </param> public virtual void LogCommand(IDbCommand command, FormatStyle style) { LogCommand(null, command, style); }
public FormatStyle DetermineActualStyle(FormatStyle style) { return FormatSql ? style : FormatStyle.None; }