Skip to content

Commit

Permalink
chore: Add static ctor to ConsoleLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
HofmeisterAn committed Mar 19, 2024
1 parent 9156593 commit ab2a8f5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Testcontainers.ActiveMq/ArtemisContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public ArtemisContainer(ActiveMqConfiguration configuration)
}

/// <summary>
/// Gets the broker address.
/// Gets the ActiveMq broker address.
/// </summary>
/// <returns>The broker address.</returns>
/// <returns>The ActiveMq broker address.</returns>
public string GetBrokerAddress()
{
var endpoint = new UriBuilder("tcp://", Hostname, GetMappedPublicPort(ArtemisBuilder.ArtemisMainPort));
var endpoint = new UriBuilder("tcp", Hostname, GetMappedPublicPort(ArtemisBuilder.ArtemisMainPort));
endpoint.UserName = Uri.EscapeDataString(_configuration.Username);
endpoint.Password = Uri.EscapeDataString(_configuration.Password);
return endpoint.ToString();
Expand Down
2 changes: 1 addition & 1 deletion src/Testcontainers.MongoDb/MongoDbContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public MongoDbContainer(MongoDbConfiguration configuration)
public string GetConnectionString()
{
// The MongoDb documentation recommends to use percent-encoding for username and password: https://www.mongodb.com/docs/manual/reference/connection-string/.
var endpoint = new UriBuilder("mongodb://", Hostname, GetMappedPublicPort(MongoDbBuilder.MongoDbPort));
var endpoint = new UriBuilder("mongodb", Hostname, GetMappedPublicPort(MongoDbBuilder.MongoDbPort));
endpoint.UserName = Uri.EscapeDataString(_configuration.Username);
endpoint.Password = Uri.EscapeDataString(_configuration.Password);
return endpoint.ToString();
Expand Down
2 changes: 1 addition & 1 deletion src/Testcontainers.Nats/NatsContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public NatsContainer(NatsConfiguration configuration)
/// <returns>A Nats connection string in the format: <c>nats://hostname:port</c>.</returns>
public string GetConnectionString()
{
var endpoint = new UriBuilder("nats://", Hostname, GetMappedPublicPort(NatsBuilder.NatsClientPort));
var endpoint = new UriBuilder("nats", Hostname, GetMappedPublicPort(NatsBuilder.NatsClientPort));
endpoint.UserName = Uri.EscapeDataString(_configuration.Username);
endpoint.Password = Uri.EscapeDataString(_configuration.Password);
return endpoint.ToString();
Expand Down
2 changes: 1 addition & 1 deletion src/Testcontainers.RabbitMq/RabbitMqContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public RabbitMqContainer(RabbitMqConfiguration configuration)
/// <returns>The RabbitMq connection string.</returns>
public string GetConnectionString()
{
var endpoint = new UriBuilder("amqp://", Hostname, GetMappedPublicPort(RabbitMqBuilder.RabbitMqPort));
var endpoint = new UriBuilder("amqp", Hostname, GetMappedPublicPort(RabbitMqBuilder.RabbitMqPort));
endpoint.UserName = Uri.EscapeDataString(_configuration.Username);
endpoint.Password = Uri.EscapeDataString(_configuration.Password);
return endpoint.ToString();
Expand Down
4 changes: 4 additions & 0 deletions src/Testcontainers/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public sealed class ConsoleLogger : ILogger, IDisposable

private LogLevel _minLogLevel = LogLevel.Information;

static ConsoleLogger()
{
}

private ConsoleLogger()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Console.IsOutputRedirected && !Console.IsErrorRedirected)
Expand Down

0 comments on commit ab2a8f5

Please sign in to comment.