Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper log level for gRPC logger. #133

Merged
merged 3 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
cd gauge
go run build/make.go --verbose
go run build/make.go --install --prefix=/tmp/
echo "::add-path::/tmp/bin"
echo "/tmp/bin" >> $GITHUB_PATH

- name: Install gauge on windows
if: matrix.os == 'windows-latest'
Expand All @@ -74,7 +74,8 @@ jobs:
cd gauge
go run build/make.go --verbose
go run build/make.go --install
echo "::add-path::C:\Program Files\gauge\bin"
echo "C:\\Program Files\\gauge\\bin" >> $GITHUB_PATH
shell: bash

- name: Install html report
run: |
Expand Down Expand Up @@ -139,7 +140,7 @@ jobs:
cd gauge
go run build/make.go --verbose
go run build/make.go --install --prefix=/tmp/
echo "::add-path::/tmp/bin"
echo "/tmp/bin" >> $GITHUB_PATH

- name: Install gauge on windows
if: matrix.os == 'windows-latest'
Expand All @@ -148,7 +149,8 @@ jobs:
cd gauge
go run build/make.go --verbose
go run build/make.go --install
echo "::add-path::C:\Program Files\gauge\bin"
echo "C:\\Program Files\\gauge\\bin" >> $GITHUB_PATH
shell: bash

- name: Install Gauge Dotnet plugin from source on windows
if: matrix.os == 'windows-latest'
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@ jobs:
- name: Build artifacts
run: |
./run.sh package

- name: update
- name: Set Version env
run: |
cd artifacts
if [ -z "$version" ]; then
version=$(ls gauge-dotnet* | sed "s/\.[^\.]*$//" | sed "s/gauge-dotnet-//");
fi
echo "::set-env name=VERSION::$version"
echo "VERSION=$version" >> $GITHUB_ENV
- name: update
run: |
cd artifacts
echo "::set-env name=::"
artifacts=()
dir=`pwd`
for i in `ls`; do
Expand Down
1 change: 0 additions & 1 deletion src/ExecutableRunnerServiceHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public override Task<ExecutionStatusResponse> StartStepExecution(StepExecutionSt

private void InitializeExecutionMessageHandlers()
{
Console.WriteLine("InitializeExecutionMessageHandlers");
var tableFormatter = new TableFormatter(this._assemblyLoader, this._activatorWrapper);
var classInstanceManager = new ThreadLocal<object>(() =>
{
Expand Down
2 changes: 1 addition & 1 deletion src/Gauge.Dotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>netcoreapp3.0</TargetFramework>
<PackageId>Runner.NetCore30</PackageId>
<Authors>The Gauge Team</Authors>
<Version>0.3.0</Version>
<Version>0.3.1</Version>
<Company>ThoughtWorks Inc.</Company>
<Product>Gauge</Product>
<Description>C# runner for Gauge. https://gauge.org</Description>
Expand Down
21 changes: 13 additions & 8 deletions src/GaugeListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,20 @@ public virtual void ConfigureServices(IServiceCollection services)
var assemblyPath = new AssemblyLocater(new DirectoryWrapper()).GetTestAssembly();
Logger.Debug($"Loading assembly from : {assemblyPath}");
services.AddGrpc();
services.AddLogging(logConfig => {
if (Utils.TryReadEnvValue("GAUGE_LOG_LEVEL") == "DEBUG")
services.AddLogging(logConfig =>
{
logConfig.SetMinimumLevel(LogLevel.Error);
var logLevel = Utils.TryReadEnvValue("GAUGE_LOG_LEVEL");
if (logLevel != null && logLevel.ToUpper() == "DEBUG")
{
logConfig.AddFilter("Microsoft", LogLevel.None);
logConfig.SetMinimumLevel(LogLevel.Debug);
}
});
services.AddSingleton<IReflectionWrapper, ReflectionWrapper>();
services.AddSingleton<IActivatorWrapper, ActivatorWrapper>();
services.AddSingleton<ExecutorPool>(new ExecutorPool(GetNoOfStreams(), IsMultithreading()));
services.AddSingleton<IGaugeLoadContext>((sp) => {
services.AddSingleton<IGaugeLoadContext>((sp) =>
{
var isDaemon = string.Compare(Environment.GetEnvironmentVariable("IS_DAEMON"), "true", true) == 0;
return isDaemon ? new LockFreeGaugeLoadContext(assemblyPath) : new GaugeLoadContext(assemblyPath);
});
Expand All @@ -56,7 +60,7 @@ public virtual void ConfigureServices(IServiceCollection services)
services.AddSingleton<IAttributesLoader, AttributesLoader>();
services.AddSingleton<IStepRegistry>(s => s.GetRequiredService<IStaticLoader>().GetStepRegistry());

if(Configuration.GetValue<string>("ReflectionScanAssemblies") == "True")
if (Configuration.GetValue<string>("ReflectionScanAssemblies") == "True")
{
Logger.Debug("Using ExecutableRunnerServiceHandler");
services.AddSingleton<Gauge.Messages.Runner.RunnerBase, ExecutableRunnerServiceHandler>();
Expand All @@ -71,14 +75,15 @@ public virtual void ConfigureServices(IServiceCollection services)
public virtual void Configure(IApplicationBuilder app, IHostApplicationLifetime lifetime)
{
app.UseRouting();
lifetime.ApplicationStarted.Register(() => {
lifetime.ApplicationStarted.Register(() =>
{
var ports = app.ServerFeatures
.Get<IServerAddressesFeature>().Addresses
.Select(x => new Uri(x).Port).Distinct();
foreach(var port in ports)
foreach (var port in ports)
{
Console.WriteLine($"Listening on port:{port}");
}
}
});

app.UseEndpoints(endpoints =>
Expand Down
2 changes: 1 addition & 1 deletion src/dotnet.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "dotnet",
"version": "0.3.0",
"version": "0.3.1",
"description": "C# support for gauge + .NET Core 3.0",
"run": {
"windows": [
Expand Down