Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BailunTrace
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wms
BailunTrace
Commits
f1aec9dd
Commit
f1aec9dd
authored
Apr 11, 2020
by
huangzhihong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix Logger.SetIdentity
parent
664bb4aa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
MicroLoggerExtensions.cs
...ceFabric.Trace/Extensions/Logger/MicroLoggerExtensions.cs
+2
-2
SeriLoggerExtensions.cs
...iceFabric.Trace/Extensions/Logger/SeriLoggerExtensions.cs
+2
-2
No files found.
src/Bailun.ServiceFabric.Trace/Extensions/Logger/MicroLoggerExtensions.cs
View file @
f1aec9dd
...
@@ -61,13 +61,13 @@ namespace Microsoft.Extensions.Logging
...
@@ -61,13 +61,13 @@ namespace Microsoft.Extensions.Logging
/// <param name="userId">用户Id</param>
/// <param name="userId">用户Id</param>
/// <param name="userName">用户名</param>
/// <param name="userName">用户名</param>
/// <returns></returns>
/// <returns></returns>
internal
static
ILogger
SetIdentity
(
this
ILogger
logger
,
string
userId
,
string
userName
=
null
)
public
static
ILogger
SetIdentity
(
this
ILogger
logger
,
string
userId
,
string
userName
=
null
)
{
{
LogContext
.
PushProperty
(
Constants
.
UserIdPropertyName
,
userId
);
LogContext
.
PushProperty
(
Constants
.
UserIdPropertyName
,
userId
);
if
(!
string
.
IsNullOrWhiteSpace
(
userName
))
if
(!
string
.
IsNullOrWhiteSpace
(
userName
))
{
{
LogContext
.
PushProperty
(
Constants
.
User
Id
PropertyName
,
userName
);
LogContext
.
PushProperty
(
Constants
.
User
Name
PropertyName
,
userName
);
}
}
return
logger
;
return
logger
;
}
}
...
...
src/Bailun.ServiceFabric.Trace/Extensions/Logger/SeriLoggerExtensions.cs
View file @
f1aec9dd
...
@@ -62,13 +62,13 @@ namespace Serilog
...
@@ -62,13 +62,13 @@ namespace Serilog
/// <param name="userId">用户Id</param>
/// <param name="userId">用户Id</param>
/// <param name="userName">用户名</param>
/// <param name="userName">用户名</param>
/// <returns></returns>
/// <returns></returns>
internal
static
ILogger
SetIdentity
(
this
ILogger
logger
,
string
userId
,
string
userName
=
null
)
public
static
ILogger
SetIdentity
(
this
ILogger
logger
,
string
userId
,
string
userName
=
null
)
{
{
LogContext
.
PushProperty
(
Constants
.
UserIdPropertyName
,
userId
);
LogContext
.
PushProperty
(
Constants
.
UserIdPropertyName
,
userId
);
if
(!
string
.
IsNullOrWhiteSpace
(
userName
))
if
(!
string
.
IsNullOrWhiteSpace
(
userName
))
{
{
LogContext
.
PushProperty
(
Constants
.
User
Id
PropertyName
,
userName
);
LogContext
.
PushProperty
(
Constants
.
User
Name
PropertyName
,
userName
);
}
}
return
logger
;
return
logger
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment