x) split out formatting text portion of log messages
This commit is contained in:
parent
3bbf5e50df
commit
94ce81da96
@ -68,15 +68,15 @@ static public class log
|
|||||||
cat = autoCat;
|
cat = autoCat;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var pathPieces = path.Split( '\\' );
|
var pathPieces = path.Split( '\\' );
|
||||||
|
|
||||||
if(pathPieces.Length < 2)
|
if(pathPieces.Length < 2)
|
||||||
{
|
{
|
||||||
pathPieces = path.Split('/');
|
pathPieces = path.Split('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var lastDir = pathPieces[ pathPieces.Length - 2 ];
|
var lastDir = pathPieces[ pathPieces.Length - 2 ];
|
||||||
|
|
||||||
ImmutableInterlocked.AddOrUpdate( ref s_shortname, pathHash, lastDir, ( key, value ) => { return lastDir; } );
|
ImmutableInterlocked.AddOrUpdate( ref s_shortname, pathHash, lastDir, ( key, value ) => { return lastDir; } );
|
||||||
@ -378,6 +378,25 @@ static public class log
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public string msgHeader( LogEvent evt )
|
||||||
|
{
|
||||||
|
char sym = getSymbol( evt.LogType );
|
||||||
|
|
||||||
|
var truncatedCat = evt.Cat.Substring( 0, Math.Min( 8, evt.Cat.Length ) );
|
||||||
|
|
||||||
|
var msgHdr = string.Format( "{0,-8}{1}| ", truncatedCat, sym );
|
||||||
|
|
||||||
|
return msgHdr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public string msgFrom( LogEvent evt )
|
||||||
|
{
|
||||||
|
var msgHdr = msgHeader( evt );
|
||||||
|
|
||||||
|
string finalLine = $"{msgHdr}{evt.Msg}";
|
||||||
|
|
||||||
|
return finalLine;
|
||||||
|
}
|
||||||
|
|
||||||
static private void writeToAll( LogEvent evt )
|
static private void writeToAll( LogEvent evt )
|
||||||
{
|
{
|
||||||
@ -386,12 +405,8 @@ static public class log
|
|||||||
// _SHOULDNT_ need this since we lock at the top.
|
// _SHOULDNT_ need this since we lock at the top.
|
||||||
//lock( this )
|
//lock( this )
|
||||||
{
|
{
|
||||||
char sym = getSymbol( evt.LogType );
|
|
||||||
|
|
||||||
|
var finalLine = msgFrom( evt );
|
||||||
var truncatedCat = evt.Cat.Substring( 0, Math.Min( 8, evt.Cat.Length ) );
|
|
||||||
|
|
||||||
string finalLine = string.Format( "{0,-8}{1}| {2}", truncatedCat, sym, evt.Msg );
|
|
||||||
|
|
||||||
//Console.WriteLine( finalMsg );
|
//Console.WriteLine( finalMsg );
|
||||||
//Console.Out.Write( finalMsg );
|
//Console.Out.Write( finalMsg );
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user