首页 > 代码库 > 简单的log

简单的log

简单的方法想日志中追加内容

public static void updateSql(string Name,string str)        {            FileStream fs = new FileStream(@"D:\Acer\logSql.txt", FileMode.Append);            StreamWriter sw = new StreamWriter(fs,Encoding.UTF8);            //开始写入            sw.Write("\r\n\n" +Name +"文件\r\n" + str + "\r\n");            //清空缓冲区            sw.Flush();            //关闭流            sw.Close();            fs.Close();        }        public static void updateNumberOfColumns(string Name, string str)        {            FileStream fs = new FileStream(@"D:\Acer\logColumns.txt", FileMode.Append);            StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);            //开始写入            sw.Write("\r\n\n" + Name + "文件\r\n数据:" + str + " 列数不正确\r\n");            //清空缓冲区            sw.Flush();            //关闭流            sw.Close();            fs.Close();        }        public static void updateInventory(string name, string str)        {            FileStream fs = new FileStream(@"D:\Acer\PAP_Inventory.txt", FileMode.Append);            StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);            //开始写入            sw.Write("\r\n\n"+name+"---" + str+"----");            //清空缓冲区            sw.Flush();            //关闭流            sw.Close();            fs.Close();        }        public static void updateSellout(string name, string str)        {            FileStream fs = new FileStream(@"D:\Acer\PAP_Sellout.txt", FileMode.Append);            StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);            //开始写入            sw.Write("\r\n\n" + name + "---" + str + "----");            //清空缓冲区            sw.Flush();            //关闭流            sw.Close();            fs.Close();        }        public static void updateaa(string name, string str)        {            FileStream fs = new FileStream(@"D:\Acer\sss.txt", FileMode.Append);            StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);            //开始写入            sw.Write("\r\n\n" + name + "---" + str + "----");            //清空缓冲区            sw.Flush();            //关闭流            sw.Close();            fs.Close();        }

 

简单的log