gajus / gajus/roarr

Consider simplifying log function interface

Open
#64 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.1k
Forks
41
PR merge metrics
No merged PRs in 30d

Description

There is no real difference between:

```ts
log.info({time: 1}, 'foo');
```

and

```ts
log.child({time: 1}).info('foo');
```

If we dropper the former API interface, it would make it easier to avoid mistakes such as [attempting to pass context as printf parameters](https://github.com/gajus/roarr/commit/a7376a9be6f25d05ea8dd194eae2e112c838ab56).

Great suggestion by @mikeroelens.

The only concern here is that it is a major breaking change with no easy way to add backwards compatibility. I doubt it will be implemented due to the latter reason, but worth considering how we could promote this pattern more.

Contributor guide

No contributing guide indexed for this repository

Research direction

No file, test, or entry point is identified. Start by locating the existing log.info context-argument and log.child APIs, then determine whether the breaking interface change or documentation and promotion of the child pattern is intended; done is not defined beyond resolving that design decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
observability-sre
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.