本文整理汇总了C#中Log.Write方法的典型用法代码示例。如果您正苦于以下问题:C# Log.Write方法的具体用法?C# Log.Write怎么用?C# Log.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log.Write方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DebugLog
public void DebugLog(Log log)
{
// TODO:
log.Write("Edge Data");
log.Write("---------");
for (int i = 0; i < triangles.Count; i++) {
Triangle t = (Triangle)triangles[i];
log.Write("Triangle {0} = [indexSet={1}, vertexSet={2}, v0={3}, v1={4}, v2={5}]",
i, t.indexSet, t.vertexSet, t.vertIndex[0], t.vertIndex[1], t.vertIndex[2]);
}
for (int i = 0; i < edgeGroups.Count; i++) {
EdgeGroup group = (EdgeGroup)edgeGroups[i];
log.Write("Edge Group vertexSet={0}", group.vertexSet);
for (int j = 0; j < group.edges.Count; j++) {
Edge e = (Edge)group.edges[j];
log.Write("Edge {0} = [\ntri0={1}, \ntri1={2}, \nv0={3}, \nv1={4}, \n degenerate={5}\n]",
j, e.triIndex[0], e.triIndex[1], e.vertIndex[0], e.vertIndex[1], e.isDegenerate);
}
}
}
示例2: Platform
Platform()
{
log = new Log ();
// TODO initialize platform
log.Write ("Platform initialized", LogType.Information);
log.Write ("OS: " + Environment.OSVersion + "\t64bit: " + Environment.Is64BitOperatingSystem, LogType.Information);
log.Write ("CPU: -type-\tCount: " + Environment.ProcessorCount, LogType.Information); // TODO add cpu type
}
示例3: WebPage
public WebPage(Uri uri)
{
_logger = Log.Instance;
_uri = uri;
_html = new HtmlDocument();
try
{
_addressHash = Helper.ResolveDNS(uri.DnsSafeHost).Address.GetHashCode();
}
catch (Exception e)
{
_addressHash = new IPAddress(new byte[] { 0, 0, 0, 0 }).Address.GetHashCode();
_logger.Write(LogLevel.Error, "WebPage: DNS Resolving failed");
_logger.Write(LogLevel.Error, uri.DnsSafeHost);
_logger.Write(LogLevel.Error, e.ToString());
}
IsLoaded = false;
}
示例4: TestLog
private static void TestLog()
{
if (File.Exists(@"D:\foo.txt"))
File.Delete(@"D:\foo.txt");
Log log = new Log(@"D:\foo.txt", 0, true);
log.MaxSize = 2048;
log.MaxNumberBackups = 0;
for (int i = 0; i < 1000; i++)
log.Write("test " + i.ToString() + System.Environment.NewLine);
log.Flush();
}
示例5: btnOK_Click
protected void btnOK_Click(object sender, EventArgs e)
{
lbErrPwd.Visible = false;
if (_User == null)
{
return;
}
if (string.IsNullOrEmpty(tbVerPwd.Text))
{
Shove._Web.JavaScript.Alert(this.Page, "请填写您的密码。");
lbErrPwd.Text = "*";
lbErrPwd.Visible = true;
tbVerPwd.Focus();
return;
}
if (!PF.EncryptPassword(tbVerPwd.Text).Equals(_User.Password))
{
Shove._Web.JavaScript.Alert(this.Page, "密码不正确,请重新输入密码。");
tbVerPwd.Focus();
return;
}
if (string.IsNullOrEmpty(_User.RealityName) && string.IsNullOrEmpty(tbRealityName.Text))
{
Shove._Web.JavaScript.Alert(this.Page, "请输入真实姓名。");
return;
}
if (string.IsNullOrEmpty(_User.IDCardNumber) && !string.IsNullOrEmpty(tbIDCardNumber.Text))
{
if (!Shove._String.Valid.isIDCardNumber(tbIDCardNumber.Text) && !Shove._String.Valid.isIDCardNumber_Hongkong(tbIDCardNumber.Text) &&
!Shove._String.Valid.isIDCardNumber_Macau(tbIDCardNumber.Text) && !Shove._String.Valid.isIDCardNumber_Taiwan(tbIDCardNumber.Text) &&
!Shove._String.Valid.isIDCardNumber_Singapore(tbIDCardNumber.Text))
{
Shove._Web.JavaScript.Alert(this.Page, "身份证号码输入有误!");
return;
}
_User.IDCardNumber = Shove._Web.Utility.FilteSqlInfusion(tbIDCardNumber.Text);
//根据当前的身份证号查询此身份证号的历史用户的CPSID是否为"来宝商家"CSPID-839,是,则把当前会员的CPSID也置为宝商家CSPID-839
if (tbIDCardNumber.Text.Trim() != "")
{
object resObj = Shove.Database.MSSQL.ExecuteScalar("select 1 from T_Users where IDCardNumber='" + Shove._Web.Utility.FilteSqlInfusion(tbIDCardNumber.Text) + "' and CpsID=839 ", new Shove.Database.MSSQL.Parameter[0]);
if (resObj != null && _User.CpsID != 839)
{
_User.CpsID = 839;
}
}
}
if (tbEmail.Text.Trim() == "")
{
Shove._Web.JavaScript.Alert(this.Page, "请输入电子邮件地址。");
tbEmail.Focus();
return;
}
if (!Shove._String.Valid.isEmail(tbEmail.Text.Trim()))
{
Shove._Web.JavaScript.Alert(this.Page, "电子邮件地址格式不正确。");
tbEmail.Focus();
return;
}
Users tu = new Users(_Site.ID);
_User.Clone(tu);
if (string.IsNullOrEmpty(_User.RealityName))
{
_User.RealityName = Shove._Web.Utility.FilteSqlInfusion(tbRealityName.Text);
}
_User.CityID = ddlCity.City_id;
_User.Sex = rbSexM.Checked ? "男" : (rbSexW.Checked ? "女" : "");
_User.BirthDay = Shove._Convert.StrToDateTime(tbBirthday.Text.Trim(), "1980-1-1");
_User.Address = tbAddress.Text.Trim();
_User.Mobile = tbMobile.Text;
_User.isMobileValided = string.IsNullOrEmpty(tbMobile.Text) ? false : true;
if (_User.Email != Shove._Convert.ToDBC(tbEmail.Text).Trim()) //改变了邮箱,需要重新验证
{
_User.isEmailValided = false;
}
_User.Email = Shove._Convert.ToDBC(tbEmail.Text).Trim();
string ReturnDescription = "";
int Result = _User.EditByID(ref ReturnDescription);
if (Result < 0)
{
new Log("Users").Write("修改用户基本资料失败:"+ ReturnDescription);
tu.Clone(_User);
Shove._Web.JavaScript.Alert(this.Page, ReturnDescription);
return;
}
//同步修改至主站
var log = new Log("Users");
try
{
var r = SyncUserInfoFromLottery(_User.ID, _User.RealityName, _User.IDCardNumber, _User.Email);
if (r == "1")
{
log.Write("同步修改用户基本资料成功");
//.........这里部分代码省略.........
示例6: Log
public static void Log( Log log )
{
log.Write( "CPU Identifier & Features" );
log.Write( "-------------------------" );
log.Write( cpuIdentifier );
log.Write( " * SSE1: {0}", IsSupported( CPUFeature.SSE1 ) );
log.Write( " * SSE2: {0}", IsSupported( CPUFeature.SSE2 ) );
log.Write( " * SSE3: {0}", IsSupported( CPUFeature.SSE3 ) );
log.Write( " * SSSE3: {0}", IsSupported( CPUFeature.SSE41 ) );
log.Write( " * SSSE3: {0}", IsSupported( CPUFeature.SSE42 ) );
log.Write( " * SSSE3: {0}", IsSupported( CPUFeature.SSE4A ) );
log.Write( " * SSSE3: {0}", IsSupported( CPUFeature.SSSE3 ) );
log.Write( "-------------------------" );
}
示例7: Main
static void Main(string[] args)
{
string[] filepaths = new string[] { @"Composed.log", @"performance.log" };
Log log = new Log(filepaths);
log.Write();
}
示例8: DrawingLottery
//开奖派奖
private void DrawingLottery(int LotteryID, string IsuseName, string WinNumber)
{
Log log = new Log("SystemGetLotteryOpenNumber");
if (!new SLS.Lottery()[LotteryID].AnalyseWinNumber(WinNumber))
{
log.Write("开奖号码不正确!");
return;
}
int ReturnValue = 0;
string ReturnDescription = "";
DataTable dtIsuse = new DAL.Tables.T_Isuses().Open(conn, "top 1 [ID], IsOpened", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + IsuseName + "' and IsOpened=0 and year(StartTime) = YEAR(GETDATE())", "");
if (dtIsuse == null)
{
log.Write("数据读写错误001");
return;
}
if (dtIsuse.Rows.Count <= 0)
{
//log.Write("暂无对应期号信息,彩种ID:" + LotteryID.ToString() + ", 期号:" + IsuseName);
return;
}
if (Shove._Convert.StrToBool(dtIsuse.Rows[0]["IsOpened"].ToString(), false))
{
//log.Write("彩种ID:" + LotteryID + "第" + IsuseName + "期已开奖");
return;
}
long IsuseID = Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), -1);
DataTable dtWin = null;
dtWin = new DAL.Tables.T_Schemes().Open(conn, "ID", "IsuseID = " + IsuseID.ToString() + " and isOpened = 0", "");
if (dtWin == null)
{
log.Write("数据读写错误002");
return;
}
// 准备开奖,开奖之前,对出票不完整的方案进行出票处理
ReturnValue = 0;
ReturnDescription = "";
DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open(conn, "[DefaultMoney],[DefaultMoneyNoWithTax]", "LotteryID = " + LotteryID.ToString(), "[Order]");
if (dtWinTypes == null)
{
log.Write("奖金读取数据读写错误");
return;
}
double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2];
for (int y = 0; y < dtWinTypes.Rows.Count; y++)
{
WinMoneyList[y * 2] = Shove._Convert.StrToDouble(dtWinTypes.Rows[y]["DefaultMoney"].ToString(), 0);
WinMoneyList[y * 2 + 1] = Shove._Convert.StrToDouble(dtWinTypes.Rows[y]["DefaultMoneyNoWithTax"].ToString(), 0);
if (WinMoneyList[y * 2] < 0)
{
log.Write("第 " + (y + 1).ToString() + " 项奖金输入错误!");
return;
}
}
dtWin = null;
#region 开奖第一步
dtWin = new DAL.Tables.T_Schemes().Open(conn, "LotteryNumber,PlayTypeID,Multiple,ID", "isOpened = 0 and IsuseID = " + IsuseID.ToString(), "[ID]");
if (dtWin == null)
{
log.Write("方案数据读取错误");
return;
}
for (int y = 0; y < dtWin.Rows.Count; y++)
{
string LotteryNumber = "";
try
{
LotteryNumber = dtWin.Rows[y]["LotteryNumber"].ToString();
}
//.........这里部分代码省略.........
示例9: Main
private static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.White;
string fileName = args.Length < 1 ? "testscript.emu" : args[0];
string[] testfile = System.IO.File.ReadAllLines(fileName);
bool allTests = true;
int numTests = 0;
var world = new World();
foreach (string str in testfile)
{
if (Regex.IsMatch(str, @"\bcheckio.*?\(.*?\)"))
{
allTests = FCheckIo(allTests, world);
}
if (Regex.IsMatch(str, @"\bcheckstruct.*?\(.*?\)"))
{
allTests = FTestStruct(world, allTests);
}
if (Regex.IsMatch(str, @"\bload.*?\(.*?\)"))
{
world = FLoad(str);
}
if (Regex.IsMatch(str, @"\bwait.*?\(.*?\)"))
{
FWait(world, str);
}
if (Regex.IsMatch(str, @"\bswait.*?\(.*?\)"))
{
FSWait(world, str);
}
if (Regex.IsMatch(str, @"\bset.*?\(.*?\)"))
{
FSet(world, str);
}
if (Regex.IsMatch(str, @"\bread.*?\(.*?\)"))
{
FRead(world, str);
}
if (Regex.IsMatch(str, @"\btest.*?\(.*?\)"))
{
FTest(ref allTests, ref numTests, world, str);
}
if (Regex.IsMatch(str, @"\bmultitest.*?\(.*?\)"))
{
FMRead(world, str);
}
if (Regex.IsMatch(str, @"\bmultiread.*?\(.*?\)"))
{
FMTest(ref allTests, ref numTests, world, str);
}
if (Regex.IsMatch(str, @"\bdrawdebug.*?\(.*?\)"))
{
world.debug = true;
}
}
var log = new Log(@"binhl.log");
if (allTests)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("All Test - OK");
Console.ForegroundColor = ConsoleColor.White;
log.Write(world.worldName + " - OK");
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("All Test - ERROR");
Console.ForegroundColor = ConsoleColor.White;
log.Write(world.worldName + " - ERROR");
}
/*
string fileName = args.Length < 1 ? "TRIG_D" : args[0];
var node = new Node(fileName + ".binhl");
var world = new World(node);
var r = new Render(world);
Console.WriteLine("O0={0}", world.GetPortValue("O0"));
r.GetSingeLayeImage().Save("I.png");
*/
}
示例10: GetResult
public void GetResult()
{
Log moniterLog = null;
try
{
string strPath = System.Windows.Forms.Application.StartupPath + "\\Log\\";
if (Directory.Exists(strPath) == false)
{
Directory.CreateDirectory(strPath);
}
moniterLog = new Log(strPath, LogType.Daily);
setWaitEventHandler(true);
moniterLog.Write("Auto Predite, begin in GetResult", MsgType.Information);
SVMpredictone.SVMpredictoneclassClass tmp1 = new SVMpredictone.SVMpredictoneclassClass();
tmp1.SVMpredictone(1, ref Global.result, Mainfrm.dsvmdat, 1);
moniterLog.Write("Auto Predite, end in GetResult", MsgType.Information);
if (((double)Global.result) <= 40)
{
setRetEventHandler(true);
}
else if (((double)Global.result) > 40)
{
setRetEventHandler(false);
}
setWaitEventHandler(false);
tmp1 = null;
GC.Collect(0);
moniterLog.Write("Auto Predite, done in GetResult", MsgType.Information);
}
catch
{
if (moniterLog != null)
{
moniterLog.Write("Auto Predite, GetResult function error", MsgType.Error);
}
}
}
示例11: DebugLog
public unsafe void DebugLog(Log log)
{
log.Write("EdgeListBuilder Log");
log.Write("-------------------");
log.Write("Number of vertex sets: {0}", vertexDataList.Count);
log.Write("Number of index sets: {0}", indexDataList.Count);
int i, j;
// Log original vertex data
for(i = 0; i < vertexDataList.Count; i++) {
VertexData vData = (VertexData)vertexDataList[i];
log.Write(".");
log.Write("Original vertex set {0} - vertex count {1}", i, vData.vertexCount);
VertexElement posElem =
vData.vertexDeclaration.FindElementBySemantic(VertexElementSemantic.Position);
HardwareVertexBuffer vbuf =
vData.vertexBufferBinding.GetBuffer(posElem.Source);
// lock the buffer for reading
IntPtr basePtr = vbuf.Lock(BufferLocking.ReadOnly);
byte* pBaseVertex = (byte*)basePtr.ToPointer();
float* pReal;
for (j = 0; j < vData.vertexCount; j++) {
pReal = (float*)(pBaseVertex + posElem.Offset);
log.Write("Vertex {0}: ({1}, {2}, {3})", j, pReal[0], pReal[1], pReal[2]);
pBaseVertex += vbuf.VertexSize;
}
vbuf.Unlock();
}
// Log original index data
for(i = 0; i < indexDataList.Count; i += 3) {
IndexData iData = (IndexData)indexDataList[i];
log.Write(".");
log.Write("Original triangle set {0} - index count {1} - vertex set {2})",
i, iData.indexCount, indexDataVertexDataSetList[i]);
// Get the indexes ready for reading
short* p16Idx = null;
int* p32Idx = null;
IntPtr idxPtr = iData.indexBuffer.Lock(BufferLocking.ReadOnly);
if (iData.indexBuffer.Type == IndexType.Size32) {
p32Idx = (int*)idxPtr.ToPointer();
}
else {
p16Idx = (short*)idxPtr.ToPointer();
}
for (j = 0; j < iData.indexCount / 3; j++) {
if (iData.indexBuffer.Type == IndexType.Size32) {
log.Write("Triangle {0}: ({1}, {2}, {3})", j, *p32Idx++, *p32Idx++, *p32Idx++);
}
else {
log.Write("Triangle {0}: ({1}, {2}, {3})", j, *p16Idx++, *p16Idx++, *p16Idx++);
}
}
iData.indexBuffer.Unlock();
// Log common vertex list
log.Write(".");
log.Write("Common vertex list - vertex count {0}", vertices.Count);
for (i = 0; i < vertices.Count; i++) {
CommonVertex c = (CommonVertex)vertices[i];
log.Write("Common vertex {0}: (vertexSet={1}, originalIndex={2}, position={3}",
i, c.vertexSet, c.index, c.position);
}
}
}
示例12: Start
//-----------------------------------------------------------------------------------
public static void Start(string[] args)
{
ManagementGroup mg = new ManagementGroup("localhost");
IConnectorFrameworkManagement icfm = mg.ConnectorFramework;
Guid connectorGuid = new Guid("{6A1F8C0E-B8F1-4147-8C9B-5A2F98F10003}");
MonitoringConnector connector;
System.Timers.Timer FeedBackTimer = new System.Timers.Timer();
FeedBackTimer.Elapsed += new ElapsedEventHandler(GetAlertForClosing);
FeedBackTimer.Interval = 1000 * 60;
FeedBackTimer.Start();
try
{
if (args.Length == 1)
{
if (args[0] == "InstallConnector")
{
ConnectorInfo info = new ConnectorInfo();
info.Description = "Sample connector";
info.DisplayName = "Sample connector";
info.Name = "Sample connector";
connector = icfm.Setup(info, connectorGuid);
connector.Initialize();
Console.WriteLine("Connector {0} has been succefuly installed", info.DisplayName);
}
else if (args[0] == "UninstallConnector")
{
connector = icfm.GetConnector(connectorGuid);
IList<MonitoringConnectorSubscription> subscriptions;
subscriptions = icfm.GetConnectorSubscriptions();
foreach (MonitoringConnectorSubscription subscription in subscriptions)
{
if (subscription.MonitoringConnectorId == connectorGuid)
{
icfm.DeleteConnectorSubscription(subscription);
}
}
connector.Uninitialize();
icfm.Cleanup(connector);
}
return;
}
connector = icfm.GetConnector(connectorGuid);
//Обрабатываем предупреждения в бесконечном цикле так как наше приложение является службой Windows
while (true)
{
//Обьявляем перменную типа коллекция для хранения предупреждений
ReadOnlyCollection<ConnectorMonitoringAlert> alerts;
alerts = connector.GetMonitoringAlerts();
//Запускаем цикл для обработки каждого предупреждения
foreach (ConnectorMonitoringAlert alert in alerts)
{
//Делаем проверку должно ли предупреждение создавать инцидент, если да то переменной flag присваиваем значение Yes.
if (alert.ResolutionState == 0)
{
string flag = "No";
if ((alert.Priority == ManagementPackWorkflowPriority.High) && (alert.Severity == ManagementPackAlertSeverity.Warning))
{
flag = "Yes";
}
if ((alert.Priority == ManagementPackWorkflowPriority.Normal) && (alert.Severity == ManagementPackAlertSeverity.Error))
{
flag = "Yes";
}
if ((alert.Priority == ManagementPackWorkflowPriority.High) && (alert.Severity == ManagementPackAlertSeverity.Error))
{
flag = "Yes";
}
Console.WriteLine("Begin Processing Alert!");
// The criteria specifies that you want to collect
// computers running Windows Server 2003.
String criteria = "Id = " + "'" +alert.ClassId + "'";
Console.WriteLine(criteria);
ManagementPackClassCriteria classCriteria = new ManagementPackClassCriteria(criteria);
Console.WriteLine("Querying for data...");
// There should only be one item in the monitoringClasses collection.
IList<ManagementPackClass> monitoringClasses =
mg.EntityTypes.GetClasses(classCriteria);
// Get all instances of computers running Windows Server 2003 in the management group.
List<MonitoringObject> targets = new List<MonitoringObject>();
IObjectReader<MonitoringObject> reader = mg.EntityObjects.GetObjectReader<MonitoringObject>(monitoringClasses[0], ObjectQueryOptions.Default);
targets.AddRange(reader);
//.........这里部分代码省略.........