Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
[![Downloads](https://static.pepy.tech/badge/objwatch)](https://pepy.tech/projects/objwatch)
[![Python Versions](https://img.shields.io/pypi/pyversions/objwatch)](https://github.com/aeeeeeep/objwatch)
[![GitHub pull request](https://img.shields.io/badge/PRs-welcome-blue)](https://github.com/aeeeeeep/objwatch/pulls)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.16986436.svg)](https://doi.org/10.5281/zenodo.16986436)

\[ English | [中文](README_zh.md) \]

Expand Down Expand Up @@ -78,6 +77,10 @@ ObjWatch offers customizable logging formats and tracing options to suit various
- `wrapper` (ABCWrapper, optional): Custom wrapper to extend tracing and logging functionality.
- `framework` (str, optional): The multi-process framework module to use.
- `indexes` (list, optional): The indexes to track in a multi-process environment.
- `output_mode` (str, optional): Output mode for logs. Options: 'std', 'zmq'. Defaults to 'std'.
- `zmq_endpoint` (str, optional): ZeroMQ endpoint for 'zmq' mode. Defaults to "tcp://127.0.0.1:5555".
- `zmq_topic` (str, optional): ZeroMQ topic for 'zmq' mode. Defaults to "".
- `auto_start_consumer` (bool, optional): Whether to automatically start the ZeroMQ consumer. Defaults to True.

## 🚀 Getting Started

Expand Down
5 changes: 4 additions & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
[![Downloads](https://static.pepy.tech/badge/objwatch)](https://pepy.tech/projects/objwatch)
[![Python Versions](https://img.shields.io/pypi/pyversions/objwatch)](https://github.com/aeeeeeep/objwatch)
[![GitHub pull request](https://img.shields.io/badge/PRs-welcome-blue)](https://github.com/aeeeeeep/objwatch/pulls)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.16986436.svg)](https://doi.org/10.5281/zenodo.16986436)

\[ [English](README.md) | 中文 \]

Expand Down Expand Up @@ -78,6 +77,10 @@ ObjWatch 提供可定制的日志格式和追踪选项,适应不同项目需
- `wrapper` (ABCWrapper,可选) :自定义包装器,用于扩展追踪和日志记录功能,详见下文。
- `framework` (字符串,可选):需要使用的多进程框架模块。
- `indexes` (列表,可选):需要在多进程环境中跟踪的 ids。
- `output_mode` (字符串,可选):日志输出模式。选项:'std', 'zmq'。默认为 'std'。
- `zmq_endpoint` (字符串,可选):'zmq' 模式的 ZeroMQ 端点。默认为 "tcp://127.0.0.1:5555"。
- `zmq_topic` (字符串,可选):'zmq' 模式的 ZeroMQ 主题。默认为 ""。
- `auto_start_consumer` (布尔值,可选):是否自动启动 ZeroMQ 消费者。默认为 True。

## 🚀 快速开始

Expand Down
4 changes: 4 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Parameters
- `wrapper` (ABCWrapper, optional): Custom wrapper to extend tracing and logging functionality.
- `framework` (str, optional): The multi-process framework module to use.
- `indexes` (list, optional): The indexes to track in a multi-process environment.
- `output_mode` (str, optional): Output mode for logs. Options: 'std', 'zmq'. Defaults to 'std'.
- `zmq_endpoint` (str, optional): ZeroMQ endpoint for 'zmq' mode. Defaults to "tcp://127.0.0.1:5555".
- `zmq_topic` (str, optional): ZeroMQ topic for 'zmq' mode. Defaults to "".
- `auto_start_consumer` (bool, optional): Whether to automatically start the ZeroMQ consumer. Defaults to True.

🚀 Getting Started
==================
Expand Down
7 changes: 0 additions & 7 deletions docs/source/objwatch.event_handls.rst

This file was deleted.

7 changes: 7 additions & 0 deletions docs/source/objwatch.events.dispatcher.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.dispatcher module
=================================

.. automodule:: objwatch.events.dispatcher
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.formatters.abc_formatter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.formatters.abc_formatter module
===============================================

.. automodule:: objwatch.events.formatters.abc_formatter
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.formatters.log_formatter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.formatters.log_formatter module
===============================================

.. automodule:: objwatch.events.formatters.log_formatter
:members:
:undoc-members:
:show-inheritance:
19 changes: 19 additions & 0 deletions docs/source/objwatch.events.formatters.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
objwatch.events.formatters package
==================================

Submodules
----------

.. toctree::
:maxdepth: 1

objwatch.events.formatters.abc_formatter
objwatch.events.formatters.log_formatter

Module contents
---------------

.. automodule:: objwatch.events.formatters
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.handlers.abc_handler.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.handlers.abc_handler module
===========================================

.. automodule:: objwatch.events.handlers.abc_handler
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.handlers.json_output_handler.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.handlers.json_output_handler module
===================================================

.. automodule:: objwatch.events.handlers.json_output_handler
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.handlers.logging_handler.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.handlers.logging_handler module
===============================================

.. automodule:: objwatch.events.handlers.logging_handler
:members:
:undoc-members:
:show-inheritance:
20 changes: 20 additions & 0 deletions docs/source/objwatch.events.handlers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
objwatch.events.handlers package
================================

Submodules
----------

.. toctree::
:maxdepth: 1

objwatch.events.handlers.abc_handler
objwatch.events.handlers.json_output_handler
objwatch.events.handlers.logging_handler

Module contents
---------------

.. automodule:: objwatch.events.handlers
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.models.base_event.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.models.base_event module
========================================

.. automodule:: objwatch.events.models.base_event
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.models.collection_event.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.models.collection_event module
==============================================

.. automodule:: objwatch.events.models.collection_event
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.models.event_type.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.models.event_type module
========================================

.. automodule:: objwatch.events.models.event_type
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.models.function_event.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.models.function_event module
============================================

.. automodule:: objwatch.events.models.function_event
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.models.lazy_event.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.models.lazy_event module
========================================

.. automodule:: objwatch.events.models.lazy_event
:members:
:undoc-members:
:show-inheritance:
23 changes: 23 additions & 0 deletions docs/source/objwatch.events.models.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
objwatch.events.models package
==============================

Submodules
----------

.. toctree::
:maxdepth: 1

objwatch.events.models.base_event
objwatch.events.models.collection_event
objwatch.events.models.event_type
objwatch.events.models.function_event
objwatch.events.models.lazy_event
objwatch.events.models.variable_event

Module contents
---------------

.. automodule:: objwatch.events.models
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.events.models.variable_event.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.events.models.variable_event module
============================================

.. automodule:: objwatch.events.models.variable_event
:members:
:undoc-members:
:show-inheritance:
27 changes: 24 additions & 3 deletions docs/source/objwatch.events.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
objwatch.events module
======================
objwatch.events package
=======================

Submodules
----------

.. toctree::
:maxdepth: 1

objwatch.events.dispatcher

Subpackages
-----------

.. toctree::
:maxdepth: 4

objwatch.events.formatters
objwatch.events.handlers
objwatch.events.models

Module contents
---------------

.. automodule:: objwatch.events
:members:
:undoc-members:
:show-inheritance:
:show-inheritance:
4 changes: 2 additions & 2 deletions docs/source/objwatch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ Submodules
objwatch.config
objwatch.constants
objwatch.core
objwatch.event_handls
objwatch.events
objwatch.mp_handls
objwatch.runtime_info
objwatch.targets
Expand All @@ -31,5 +29,7 @@ Subpackages
.. toctree::
:maxdepth: 4

objwatch.events
objwatch.sinks
objwatch.utils
objwatch.wrappers
7 changes: 7 additions & 0 deletions docs/source/objwatch.sinks.abc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.sinks.abc module
=========================

.. automodule:: objwatch.sinks.abc
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.sinks.consumer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.sinks.consumer module
==============================

.. automodule:: objwatch.sinks.consumer
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.sinks.factory.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.sinks.factory module
=============================

.. automodule:: objwatch.sinks.factory
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.sinks.formatter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.sinks.formatter module
===============================

.. automodule:: objwatch.sinks.formatter
:members:
:undoc-members:
:show-inheritance:
23 changes: 23 additions & 0 deletions docs/source/objwatch.sinks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
objwatch.sinks package
======================

Submodules
----------

.. toctree::
:maxdepth: 1

objwatch.sinks.abc
objwatch.sinks.consumer
objwatch.sinks.factory
objwatch.sinks.formatter
objwatch.sinks.std
objwatch.sinks.zmq_sink

Module contents
---------------

.. automodule:: objwatch.sinks
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.sinks.std.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.sinks.std module
==========================

.. automodule:: objwatch.sinks.std
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/objwatch.sinks.zmq_sink.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
objwatch.sinks.zmq_sink module
================================

.. automodule:: objwatch.sinks.zmq_sink
:members:
:undoc-members:
:show-inheritance:
10 changes: 9 additions & 1 deletion objwatch/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class ObjWatchConfig:
wrapper (Optional[ABCWrapper]): Custom wrapper to extend tracing and logging functionality.
framework (Optional[str]): The multi-process framework module to use.
indexes (Optional[List[int]]): The indexes to track in a multi-process environment.
output_mode (str): Output mode for logs. Options: 'std', 'zmq'. Defaults to 'std'.
zmq_endpoint (str): ZeroMQ endpoint for 'zmq' mode. Defaults to "tcp://127.0.0.1:5555".
zmq_topic (str): ZeroMQ topic for 'zmq' mode. Defaults to "".
auto_start_consumer (bool): Whether to automatically start the ZeroMQ consumer. Defaults to True.
"""

targets: List[Union[str, ModuleType]]
Expand All @@ -37,6 +41,10 @@ class ObjWatchConfig:
wrapper: Optional[Any] = None
framework: Optional[str] = None
indexes: Optional[List[int]] = None
output_mode: str = "std"
zmq_endpoint: str = "tcp://127.0.0.1:5555"
zmq_topic: str = ""
auto_start_consumer: bool = True

def __post_init__(self) -> None:
"""
Expand All @@ -49,7 +57,7 @@ def __post_init__(self) -> None:
raise ValueError("output cannot be specified when level is 'force'")

if self.output is not None and not self.output.endswith('.objwatch'):
raise ValueError("output file must end with '.objwatch' for ObjWatch Log Viewer extension")
logging.warning("output file must end with '.objwatch' for ObjWatch Log Viewer extension")

if self.output_json is not None and not self.output_json.endswith('.json'):
raise ValueError("output_json file must end with '.json'")
Expand Down
Loading
Loading