Update logging functionality: Refactored log stop method, added missing end line write, and improved time formatting. Made adjustments to AngleSingle class for nullability.
This commit is contained in:
parent
f672ab9d2f
commit
05656d469a
@ -11,10 +11,14 @@
|
|||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>preview</LangVersion>
|
<LangVersion>preview</LangVersion>
|
||||||
|
<!--
|
||||||
|
I Want to turn this on, but cant yet. Implementing nullability 1 file at a gime
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
-->
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<NoWarn>$(NoWarn);SYSLIB0050</NoWarn>
|
<NoWarn>$(NoWarn);SYSLIB0050;CS8981</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -368,8 +368,7 @@ static public class log
|
|||||||
var timeLine = new LogEvent( LogType.Raw, $" D A T E {time.Year}/{time.Month.ToString("00")}/{time.Day.ToString("00")} T I M E {time.Hour.ToString("00")}:{time.Minute.ToString("00")}:{time.Second.ToString("00")}.{time.Millisecond.ToString("000")}{time.Microsecond.ToString("000")}", "", 0, "", "lib.time", null );
|
var timeLine = new LogEvent( LogType.Raw, $" D A T E {time.Year}/{time.Month.ToString("00")}/{time.Day.ToString("00")} T I M E {time.Hour.ToString("00")}:{time.Minute.ToString("00")}:{time.Second.ToString("00")}.{time.Millisecond.ToString("000")}{time.Microsecond.ToString("000")}", "", 0, "", "lib.time", null );
|
||||||
|
|
||||||
|
|
||||||
|
//writeToAll( endLine );
|
||||||
writeToAll( endLine );
|
|
||||||
writeToAll( blankLine );
|
writeToAll( blankLine );
|
||||||
writeToAll( blankLine );
|
writeToAll( blankLine );
|
||||||
writeToAll( beginLine );
|
writeToAll( beginLine );
|
||||||
@ -378,7 +377,6 @@ static public class log
|
|||||||
writeToAll( blankLine );
|
writeToAll( blankLine );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while( s_running )
|
while( s_running )
|
||||||
{
|
{
|
||||||
while( s_events.TryDequeue( out var evt ) )
|
while( s_events.TryDequeue( out var evt ) )
|
||||||
@ -389,12 +387,22 @@ static public class log
|
|||||||
// TODO PERF Replace this with a semaphore/mutex
|
// TODO PERF Replace this with a semaphore/mutex
|
||||||
Thread.Sleep( 0 );
|
Thread.Sleep( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeToAll( endLine );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stop()
|
public static void stop()
|
||||||
{
|
{
|
||||||
|
if( !s_running ) return;
|
||||||
|
|
||||||
s_running = false;
|
s_running = false;
|
||||||
|
|
||||||
|
while( s_thread.IsAlive )
|
||||||
|
{
|
||||||
|
Thread.Sleep( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
s_writer.Close();
|
s_writer.Close();
|
||||||
s_stream.Close();
|
s_stream.Close();
|
||||||
|
|
||||||
@ -500,7 +508,7 @@ static public class log
|
|||||||
|
|
||||||
var truncatedCat = evt.Cat.Substring( 0, Math.Min( s_catWidth, evt.Cat.Length ) );
|
var truncatedCat = evt.Cat.Substring( 0, Math.Min( s_catWidth, evt.Cat.Length ) );
|
||||||
|
|
||||||
var timeHdr = $"{evt.Time.Year}-{evt.Time.Month.ToString("00")}-{evt.Time.Day.ToString("00")} {evt.Time.Hour.ToString("00")}:{evt.Time.Minute.ToString("00")}:{evt.Time.Second.ToString("00")}.{evt.Time.Millisecond.ToString("000")}";
|
var timeHdr = $"{evt.Time.Year}-{evt.Time.Month.ToString("00")}-{evt.Time.Day.ToString("00")} {evt.Time.Hour.ToString("00")}:{evt.Time.Minute.ToString("00")}:{evt.Time.Second.ToString("00")}.{evt.Time.Millisecond.ToString("000")}{evt.Time.Microsecond.ToString("000")}";
|
||||||
|
|
||||||
var msgHdr = string.Format( $"{timeHdr} | {{0,-{s_catWidth}}}{{1}}| ", truncatedCat, sym );
|
var msgHdr = string.Format( $"{timeHdr} | {{0,-{s_catWidth}}}{{1}}| ", truncatedCat, sym );
|
||||||
|
|
||||||
@ -514,7 +522,6 @@ static public class log
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static public string msgPrint( LogEvent evt )
|
static public string msgPrint( LogEvent evt )
|
||||||
{
|
{
|
||||||
var msgHdr = headerPrint( evt );
|
var msgHdr = headerPrint( evt );
|
||||||
|
|||||||
@ -7,17 +7,17 @@
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007-2011 SlimDX Group
|
* Copyright (c) 2007-2011 SlimDX Group
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
* in the Software without restriction, including without limitation the rights
|
* in the Software without restriction, including without limitation the rights
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
* furnished to do so, subject to the following conditions:
|
* furnished to do so, subject to the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
* all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
@ -771,7 +771,7 @@ namespace math
|
|||||||
/// its value is equal to the value of the current math.Angle
|
/// its value is equal to the value of the current math.Angle
|
||||||
/// object; otherwise, false.
|
/// object; otherwise, false.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public override bool Equals( object obj )
|
public override bool Equals( object? obj )
|
||||||
{
|
{
|
||||||
return ( obj is AngleSingle ) && ( this == (AngleSingle)obj );
|
return ( obj is AngleSingle ) && ( this == (AngleSingle)obj );
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user