Example #1
0
    public static int Emit(Level level, Operation oper, string message)
    {
        try
        {
            DateTime now = DateTime.Now;
            Machine.Display(Prefix(level, now) + message);

            SqlSelect select = new SqlSelect("RDB$DATABASE", "GEN_ID(G_LOG_LOG, 1) AS F_LOG");
            int       logId;

            using (Query q = new Query(connection, select))
            {
                q.Read();
                logId = q.GetInt("F_LOG");
            }

            SqlInsert insert = new SqlInsert("T_LOG");

            insert.AddInt("F_LOG", logId);
            insert.AddString("F_PROGRAM", EventSource);
            insert.AddDateTime("F_STAMP", now);
            insert.AddInt("F_LEVEL", (int)level);
            insert.AddInt("F_OPER", (int)oper);
            insert.AddString("F_MESSAGE", message);

            connection.Execute(insert);
            return(logId);
        }
        catch (Exception ex)
        {
            LogEvent(level, oper, message);
            Abort(ex);
            throw ex;
        }
    }
Example #2
0
    public void InsertGuid(Connection conn, Guid guid)
    {
        SqlInsert insert = new SqlInsert(EPortGuidName);

        insert.AddString("F_GUID", guid.ToString());
        insert.AddDateTime("F_STAMP", DateTime.Now);
        AddFields(insert, CommonFields);
        conn.Execute(insert);
        LogText("SqlInsert", guid);
    }