Minor changes
This commit is contained in:
parent
507987b50f
commit
992c442393
15
Log.cs
15
Log.cs
@ -105,27 +105,27 @@ namespace lib
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Forwards.
|
// Forwards.
|
||||||
static public void fatal( string msg, string cat = "fatal", object obj = null )
|
static public void fatal( string msg, string cat = "", object obj = null )
|
||||||
{
|
{
|
||||||
log( msg, LogType.Fatal, cat, obj );
|
log( msg, LogType.Fatal, cat, obj );
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void error( string msg, string cat = "error", object obj = null )
|
static public void error( string msg, string cat = "", object obj = null )
|
||||||
{
|
{
|
||||||
log( msg, LogType.Error, cat, obj );
|
log( msg, LogType.Error, cat, obj );
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void warn( string msg, string cat = "warn", object obj = null )
|
static public void warn( string msg, string cat = "", object obj = null )
|
||||||
{
|
{
|
||||||
log( msg, LogType.Warn, cat, obj );
|
log( msg, LogType.Warn, cat, obj );
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void info( string msg, string cat = "info", object obj = null )
|
static public void info( string msg, string cat = "", object obj = null )
|
||||||
{
|
{
|
||||||
log( msg, LogType.Info, cat, obj );
|
log( msg, LogType.Info, cat, obj );
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void debug( string msg, string cat = "dbg", object obj = null )
|
static public void debug( string msg, string cat = "", object obj = null )
|
||||||
{
|
{
|
||||||
log( msg, LogType.Debug, cat, obj );
|
log( msg, LogType.Debug, cat, obj );
|
||||||
}
|
}
|
||||||
@ -146,11 +146,10 @@ namespace lib
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static public void logProps( object obj, string header, LogType type = LogType.Debug, string cat = "unk" )
|
static public void logProps( object obj, string header, LogType type = LogType.Debug, string cat = "", string prefix = "" )
|
||||||
{
|
{
|
||||||
var list = scr.GetAllProperties( obj.GetType() );
|
var list = scr.GetAllProperties( obj.GetType() );
|
||||||
|
|
||||||
|
|
||||||
lock( s_log )
|
lock( s_log )
|
||||||
{
|
{
|
||||||
var evt = new LogEvent( type, cat, header, obj );
|
var evt = new LogEvent( type, cat, header, obj );
|
||||||
@ -163,7 +162,7 @@ namespace lib
|
|||||||
{
|
{
|
||||||
var v = pi.GetValue( obj );
|
var v = pi.GetValue( obj );
|
||||||
|
|
||||||
log( $"{pi.Name} = {v}", type, cat );
|
log( $"{prefix}{pi.Name} = {v}", type, cat );
|
||||||
}
|
}
|
||||||
catch( Exception ex )
|
catch( Exception ex )
|
||||||
{
|
{
|
||||||
|
|||||||
10
Scr.cs
10
Scr.cs
@ -167,10 +167,14 @@ static public class scr
|
|||||||
var propArr = t.GetProperties(
|
var propArr = t.GetProperties(
|
||||||
BindingFlags.DeclaredOnly |
|
BindingFlags.DeclaredOnly |
|
||||||
BindingFlags.NonPublic |
|
BindingFlags.NonPublic |
|
||||||
BindingFlags.Public |
|
BindingFlags.Public |
|
||||||
BindingFlags.Instance);
|
BindingFlags.Instance
|
||||||
|
);
|
||||||
|
|
||||||
var en = PredEnumerator.Create<PropertyInfo>( propArr.AsEnumerable<PropertyInfo>(), fa => fa.GetCustomAttribute( typeof( NonSerializedAttribute ) ) == null );
|
|
||||||
|
|
||||||
|
var en = PredEnumerator.Create<PropertyInfo>( propArr.AsEnumerable<PropertyInfo>(),
|
||||||
|
fa => fa.GetCustomAttribute( typeof( NonSerializedAttribute ) ) == null && !list.Exists( f => f.Name == fa.Name ) );
|
||||||
|
|
||||||
list.AddRange( new PredEnumerable<PropertyInfo>( en ) );
|
list.AddRange( new PredEnumerable<PropertyInfo>( en ) );
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user