View Source GRPC.Client.Interceptors.Logger (grpc v0.6.0)

Print log around client rpc calls, like

17:13:33.021 [info]  Call say_hello of helloworld.Greeter
17:13:33.079 [info]  Got :ok in 58ms

options

Options

  • :level - the desired log level. Defaults to :info
  • :accepted_comparators - a list with the accepted Logger.compare_levels(configured_level, Logger.level()) results. Defaults to [:lt, :eq]

usage

Usage

{:ok, channel} = GRPC.Stub.connect("localhost:50051", interceptors: [GRPC.Client.Interceptors.Logger])
# This will log on `:info` and greater priority
{:ok, channel} = GRPC.Stub.connect("localhost:50051", interceptors: [{GRPC.Client.Interceptors.Logger, level: :info}])
# This will log only on `:info`
{:ok, channel} = GRPC.Stub.connect("localhost:50051", interceptors: [{GRPC.Client.Interceptors.Logger, level: :info, accepted_comparators: [:eq]}])
# This will log on `:info` and lower priority
{:ok, channel} = GRPC.Stub.connect("localhost:50051", interceptors: [{GRPC.Client.Interceptors.Logger, level: :info, accepted_comparators: [:eq, :gt]}])