Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
c4ebda7d
Commit
c4ebda7d
authored
Sep 18, 2015
by
Jan Tattermusch
Browse files
Options
Downloads
Patches
Plain Diff
plain log message should not be treated as format string
parent
1965810e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/csharp/Grpc.Core/Logging/ConsoleLogger.cs
+38
-14
38 additions, 14 deletions
src/csharp/Grpc.Core/Logging/ConsoleLogger.cs
src/csharp/Grpc.Core/Logging/ILogger.cs
+18
-6
18 additions, 6 deletions
src/csharp/Grpc.Core/Logging/ILogger.cs
with
56 additions
and
20 deletions
src/csharp/Grpc.Core/Logging/ConsoleLogger.cs
+
38
−
14
View file @
c4ebda7d
...
@@ -79,48 +79,72 @@ namespace Grpc.Core.Logging
...
@@ -79,48 +79,72 @@ namespace Grpc.Core.Logging
}
}
/// <summary>Logs a message with severity Debug.</summary>
/// <summary>Logs a message with severity Debug.</summary>
public
void
Debug
(
string
message
,
params
object
[]
formatArgs
)
public
void
Debug
(
string
message
)
{
{
Log
(
"D"
,
message
,
formatArgs
);
Log
(
"D"
,
message
);
}
/// <summary>Logs a formatted message with severity Debug.</summary>
public
void
Debug
(
string
format
,
params
object
[]
formatArgs
)
{
Debug
(
string
.
Format
(
format
,
formatArgs
));
}
}
/// <summary>Logs a message with severity Info.</summary>
/// <summary>Logs a message with severity Info.</summary>
public
void
Info
(
string
message
,
params
object
[]
formatArgs
)
public
void
Info
(
string
message
)
{
Log
(
"I"
,
message
);
}
/// <summary>Logs a formatted message with severity Info.</summary>
public
void
Info
(
string
format
,
params
object
[]
formatArgs
)
{
{
Log
(
"I"
,
message
,
formatArgs
);
Info
(
string
.
Format
(
format
,
formatArgs
)
)
;
}
}
/// <summary>Logs a message with severity Warning.</summary>
/// <summary>Logs a message with severity Warning.</summary>
public
void
Warning
(
string
message
,
params
object
[]
formatArgs
)
public
void
Warning
(
string
message
)
{
{
Log
(
"W"
,
message
,
formatArgs
);
Log
(
"W"
,
message
);
}
/// <summary>Logs a formatted message with severity Warning.</summary>
public
void
Warning
(
string
format
,
params
object
[]
formatArgs
)
{
Warning
(
string
.
Format
(
format
,
formatArgs
));
}
}
/// <summary>Logs a message and an associated exception with severity Warning.</summary>
/// <summary>Logs a message and an associated exception with severity Warning.</summary>
public
void
Warning
(
Exception
exception
,
string
message
,
params
object
[]
formatArgs
)
public
void
Warning
(
Exception
exception
,
string
message
)
{
{
Log
(
"W"
,
message
+
" "
+
exception
,
formatArgs
);
Warning
(
message
+
" "
+
exception
);
}
}
/// <summary>Logs a message with severity Error.</summary>
/// <summary>Logs a message with severity Error.</summary>
public
void
Error
(
string
message
,
params
object
[]
formatArgs
)
public
void
Error
(
string
message
)
{
Log
(
"E"
,
message
);
}
/// <summary>Logs a formatted message with severity Error.</summary>
public
void
Error
(
string
format
,
params
object
[]
formatArgs
)
{
{
Log
(
"E"
,
message
,
formatArgs
);
Error
(
string
.
Format
(
format
,
formatArgs
)
)
;
}
}
/// <summary>Logs a message and an associated exception with severity Error.</summary>
/// <summary>Logs a message and an associated exception with severity Error.</summary>
public
void
Error
(
Exception
exception
,
string
message
,
params
object
[]
formatArgs
)
public
void
Error
(
Exception
exception
,
string
message
)
{
{
Log
(
"E"
,
message
+
" "
+
exception
,
formatArgs
);
Error
(
message
+
" "
+
exception
);
}
}
private
void
Log
(
string
severityString
,
string
message
,
object
[]
formatArgs
)
private
void
Log
(
string
severityString
,
string
message
)
{
{
Console
.
Error
.
WriteLine
(
"{0}{1} {2}{3}"
,
Console
.
Error
.
WriteLine
(
"{0}{1} {2}{3}"
,
severityString
,
severityString
,
DateTime
.
Now
,
DateTime
.
Now
,
forTypeString
,
forTypeString
,
string
.
Format
(
message
,
formatArgs
)
);
message
);
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
src/csharp/Grpc.Core/Logging/ILogger.cs
+
18
−
6
View file @
c4ebda7d
...
@@ -43,21 +43,33 @@ namespace Grpc.Core.Logging
...
@@ -43,21 +43,33 @@ namespace Grpc.Core.Logging
ILogger
ForType
<
T
>();
ILogger
ForType
<
T
>();
/// <summary>Logs a message with severity Debug.</summary>
/// <summary>Logs a message with severity Debug.</summary>
void
Debug
(
string
message
,
params
object
[]
formatArgs
);
void
Debug
(
string
message
);
/// <summary>Logs a formatted message with severity Debug.</summary>
void
Debug
(
string
format
,
params
object
[]
formatArgs
);
/// <summary>Logs a message with severity Info.</summary>
/// <summary>Logs a message with severity Info.</summary>
void
Info
(
string
message
,
params
object
[]
formatArgs
);
void
Info
(
string
message
);
/// <summary>Logs a formatted message with severity Info.</summary>
void
Info
(
string
format
,
params
object
[]
formatArgs
);
/// <summary>Logs a message with severity Warning.</summary>
/// <summary>Logs a message with severity Warning.</summary>
void
Warning
(
string
message
,
params
object
[]
formatArgs
);
void
Warning
(
string
message
);
/// <summary>Logs a formatted message with severity Warning.</summary>
void
Warning
(
string
format
,
params
object
[]
formatArgs
);
/// <summary>Logs a message and an associated exception with severity Warning.</summary>
/// <summary>Logs a message and an associated exception with severity Warning.</summary>
void
Warning
(
Exception
exception
,
string
message
,
params
object
[]
formatArgs
);
void
Warning
(
Exception
exception
,
string
message
);
/// <summary>Logs a message with severity Error.</summary>
/// <summary>Logs a message with severity Error.</summary>
void
Error
(
string
message
,
params
object
[]
formatArgs
);
void
Error
(
string
message
);
/// <summary>Logs a formatted message with severity Error.</summary>
void
Error
(
string
format
,
params
object
[]
formatArgs
);
/// <summary>Logs a message and an associated exception with severity Error.</summary>
/// <summary>Logs a message and an associated exception with severity Error.</summary>
void
Error
(
Exception
exception
,
string
message
,
params
object
[]
formatArgs
);
void
Error
(
Exception
exception
,
string
message
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment