Skip to content

Commit

Permalink
Merge pull request #20 from adator85/V1.x.x
Browse files Browse the repository at this point in the history
Creating logger name, avoiding that rpc will not bypass the root program
  • Loading branch information
adator85 authored Nov 11, 2024
2 parents 096920a + 54d1eb0 commit 4ed2ddf
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
Binary file added dist/unrealircd_rpc_py-1.0.7-py3-none-any.whl
Binary file not shown.
Binary file added dist/unrealircd_rpc_py-1.0.7.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='unrealircd_rpc_py',
version='1.0.6',
version='1.0.7',
packages=find_packages(),
install_requires=[
"requests>=2.25.1",
Expand Down
20 changes: 16 additions & 4 deletions unrealircd_rpc_py/Connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,22 @@ def __init_log_system(self) -> None:
"""Init log system
"""
# Init logs object
self.Logs = logging
self.Logs.basicConfig(level=self.debug_level,
encoding='UTF-8',
format='%(asctime)s - %(levelname)s - %(filename)s - %(lineno)d - %(funcName)s - %(message)s')
self.Logs: logging.Logger = logging.getLogger('unrealircd-rpc-py')
self.Logs.propagate = False
self.Logs.setLevel(self.debug_level)

# Add Handlers
stdout_hanlder = logging.StreamHandler()
stdout_hanlder.setLevel(self.debug_level)

# Define log format
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(filename)s - %(lineno)d - %(funcName)s - %(message)s')

# Apply log format
stdout_hanlder.setFormatter(formatter)

# Add handler to logs
self.Logs.addHandler(stdout_hanlder)

def query(self, method: Union[Literal['stats.get', 'rpc.info','user.list'], str], param: dict = {}, id: int = 123, jsonrpc:str = '2.0') -> Union[str, any, None, bool]:
"""This method will use to run the queries
Expand Down
19 changes: 15 additions & 4 deletions unrealircd_rpc_py/Live.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,21 @@ def __init_log_system(self) -> None:
"""Init log system
"""
# Init logs object
self.Logs = logging
self.Logs.basicConfig(level=self.debug_level,
encoding='UTF-8',
format='%(asctime)s - %(levelname)s - %(filename)s - %(lineno)d - %(funcName)s - %(message)s')
self.Logs: logging.Logger = logging.getLogger('unrealircd-liverpc-py')
self.Logs.setLevel(self.debug_level)

# Add Handlers
stdout_hanlder = logging.StreamHandler()
stdout_hanlder.setLevel(self.debug_level)

# Define log format
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(filename)s - %(lineno)d - %(funcName)s - %(message)s')

# Apply log format
stdout_hanlder.setFormatter(formatter)

# Add handler to logs
self.Logs.addHandler(stdout_hanlder)

def subscribe(self, sources: list = ["!debug", "all"]):
"""Subscribe to the rpc server stream
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.0.6"
"version": "1.0.7"
}

0 comments on commit 4ed2ddf

Please sign in to comment.