Suor/funcy

Add max_repr_len argument to log/print_calls decorator

ADR-007 opened this issue · 2 comments

The decorator is not very useful for me because I can't see with which arguments called the function.

from typing import NamedTuple

from funcy import print_calls


class Parameters(NamedTuple):
    main_value: int
    second_value: str


@print_calls
def process(parameters: Parameters):
    pass


process(Parameters(1, '10'))
process(Parameters(2, '20'))
process(Parameters(3, '30'))

Result:

Call process(Parameters(main_value=...)
-> None from process(Parameters(main_value=...)
Call process(Parameters(main_value=...)
-> None from process(Parameters(main_value=...)
Call process(Parameters(main_value=...)
-> None from process(Parameters(main_value=...)

It would be great if I can define how long should be argument representation

Suor commented

This makes sense, I've came across things a few times too. I wonder, though, whether this should be regulated globally or on parameter basis.

Thank you!