Exemple #1
0
        public virtual XVar writeToLogFile(dynamic _param_str)
        {
            #region pass-by-value parameters
            dynamic str = XVar.Clone(_param_str);
            #endregion

            dynamic fsize = null, fullname = null, logfileExt = null, logfileName = null, p = null, str_to_append = null, tn = null;
            p           = XVar.Clone(MVCFunctions.strrpos((XVar)(this.logfile), new XVar(".")));
            logfileName = XVar.Clone(MVCFunctions.runner_substr((XVar)(this.logfile), new XVar(0), (XVar)(p)));
            logfileExt  = XVar.Clone(MVCFunctions.runner_substr((XVar)(this.logfile), (XVar)(p + 1), (XVar)(MVCFunctions.strlen((XVar)(this.logfile)) - 1)));
            tn          = XVar.Clone(MVCFunctions.Concat(logfileName, "_", CommonFunctions.format_datetime_custom((XVar)(CommonFunctions.db2time((XVar)(MVCFunctions.now()))), new XVar("yyyyMMdd")), ".", logfileExt));
            fullname    = XVar.Clone(MVCFunctions.getabspath((XVar)(tn)));
            fsize       = new XVar(0);
            if (XVar.Pack(MVCFunctions.file_exists((XVar)(fullname))))
            {
                fsize = XVar.Clone(MVCFunctions.filesize((XVar)(fullname)));
            }
            str_to_append = new XVar("");
            if (XVar.Pack(!(XVar)(fsize)))
            {
                str_to_append = XVar.Clone(MVCFunctions.Concat(this.columnDate, MVCFunctions.chr(new XVar(9)), this.columnTime, MVCFunctions.chr(new XVar(9)), this.columnIP, MVCFunctions.chr(new XVar(9)), this.columnUser, MVCFunctions.chr(new XVar(9)), this.columnTable, MVCFunctions.chr(new XVar(9)), this.columnAction, MVCFunctions.chr(new XVar(9)), this.columnKey, MVCFunctions.chr(new XVar(9)), this.columnField, MVCFunctions.chr(new XVar(9)), this.columnOldValue, MVCFunctions.chr(new XVar(9)), this.columnNewValue, "\r\n"));
            }
            str_to_append = MVCFunctions.Concat(str_to_append, str);
            MVCFunctions.append_to_file((XVar)(fullname), (XVar)(str_to_append));
            return(null);
        }