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

Redesign base logger API #90

Merged
merged 107 commits into from
Apr 7, 2023
Merged

Redesign base logger API #90

merged 107 commits into from
Apr 7, 2023

Conversation

muir
Copy link
Collaborator

@muir muir commented Feb 13, 2023

BREAKING CHANGE

This is a breaking change and major rewrite. Most of the changes are in the base loggers.

Any -> Model, Link

New Line finishers have been added: Link() and Model(). Link() as a line attribute has been removed. Any() remains, but Model() is now preferred

AnyImmutable

AnyImmutable() line attribute is removed

Static

Static() line finishers is removed.

replay

Base loggers MAY now consume their own output to call other base loggers thus transforming the output from one base logger format to another. Full fidelity replay is supported with xopotel, xoppb, xopjson, and xoptest.

xoppb

xoppb is a new xop-native protobuf logger. The xop protobuf definitions, in xopproto have also changed.

xopbase

Baselogger Request() now requires a SourceInfo parameter to define the origin of the logs.

Objects (for Any() and Model()) are now passed in a ModelArg object that supports multiple encoding formats.

Stack traces are now expanded in the top-level logger rather than in base loggers.

xopjson

Most of the configuration options for xopjson have been removed for the time being. A xopjs that is configurable is planned, but not implemented yet.

xopotel

The encoding for xop logs in OTEL has changed. Line attributes are now almost all string slices with the second element being a type indicator.

BaseLogger() now takes a TracerProvider instead of a Tracer.

xoptest

The public data structures have been adjusted in fairly minor ways.

Other misc breaking changes

SeedReactiveCallback has a slightly different API

BytesWriter's DefineAttribute method has a slightly different API.

What was HexByte's Set() is now SetArray() and Set() now takes a HexByte.

xoputil's SkipLine has moved to xopbase

Backwards compatible changes

  • WithNamespace() and WithSource() seed modifiers have been added and should be used to provide information about the source of the logs.
  • StackFilenameRewrite() is a new LogSettings method that can be used to fine-tune stack traces
  • CombineBaseLoggers() added that can bundle multiple base loggers into a single logger API. Loggers bundled this way cannot be individually removed from a *Log.
  • Seed now has a .String() for debugging
  • Attribute definitions can now be constructed on the fly and attribute definitions can be in separate namespaces
  • xopproto enum types can now Marshal and Unmarshal.
  • HexByte types can be constructed from strings
  • Trace can now Marshal/Unmarshal

@muir muir requested review from miccagiann and sharnoff April 2, 2023 04:22
@muir
Copy link
Collaborator Author

muir commented Apr 2, 2023

I'm still working on this but in a minor way: increasing test coverage.

I'm not expecting any kind of thorough review -- the change is just too big. But if you browse through it, you might spot something that needs to be addressed.

Thanks!

@muir muir mentioned this pull request Apr 2, 2023
Copy link
Collaborator

@miccagiann miccagiann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Massive PR!

@muir muir merged commit 0d7303e into main Apr 7, 2023
@muir muir deleted the redo branch April 7, 2023 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants