Skip to content

add thin logging shim - #484

Open
davidkoski wants to merge 3 commits into
mainfrom
logging
Open

davidkoski wants to merge 3 commits into
mainfrom
logging

Conversation

@davidkoski

Copy link
Copy Markdown
Member

Proposed changes

See ml-explore/mlx-swift-lm#535 (comment)

mlx-swift and related sometimes (rarely) wants to log something. We never picked a solution, and I don't want to lock people in to any particular solution. This adds a very thin logging shim that looks similar to swift-log and has a default OSLog/stderr implementation. Developers can integrate whatever they want and MLX code can now log things if needed.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

@nwh nwh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice! The API is also similar to conventional Python logging. eg

import logging
logger = logging.getLogger(__name__)

def foo():
    logger.info("foo was called")

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.

2 participants