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

Turning off logger at the class-constructor level #323

Merged
merged 20 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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 src/core/zowe/core_for_zowe_sdk/sdk_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ class SdkApi:
Name of the logger (same as the filename by default)
"""

def __init__(self, profile: dict, default_url: str, logger_name: str = __name__):
def __init__(self, profile: dict, default_url: str, logger_name: str = __name__, log = False):
aadityasinha-dotcom marked this conversation as resolved.
Show resolved Hide resolved
session = Session(profile)
self.session: ISession = session.load()

self.logger = Log.register_logger(logger_name)

if log == False:
Log.close(self.logger)
aadityasinha-dotcom marked this conversation as resolved.
Show resolved Hide resolved

self._default_service_url = default_url
self._default_headers = {
"Content-Type": "application/json",
Expand Down
2 changes: 1 addition & 1 deletion src/zos_console/zowe/zos_console_for_zowe_sdk/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Console(SdkApi):
A profile in dict (json) format
"""

def __init__(self, connection: dict):
def __init__(self, connection: dict, log = False):
aadityasinha-dotcom marked this conversation as resolved.
Show resolved Hide resolved
super().__init__(connection, "/zosmf/restconsoles/consoles/defcn", logger_name=__name__)
aadityasinha-dotcom marked this conversation as resolved.
Show resolved Hide resolved

def issue_command(self, command: str, console: Optional[str] = None) -> IssueCommandResponse:
Expand Down
2 changes: 1 addition & 1 deletion src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class Datasets(SdkApi):
A profile for connection in dict (json) format
"""

def __init__(self, connection: dict):
def __init__(self, connection: dict, log = False):
super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__)
aadityasinha-dotcom marked this conversation as resolved.
Show resolved Hide resolved
self._default_headers["Accept-Encoding"] = "gzip"

Expand Down
2 changes: 1 addition & 1 deletion src/zos_files/zowe/zos_files_for_zowe_sdk/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Files(SdkApi):
uss: USSFiles
fs: FileSystems

def __init__(self, connection: dict):
def __init__(self, connection: dict, log = False):
super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__)
self._default_headers["Accept-Encoding"] = "gzip"
self.ds = Datasets(connection)
Expand Down
2 changes: 1 addition & 1 deletion src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class USSFiles(SdkApi):
The z/OSMF connection object (generated by the ZoweSDK object)
"""

def __init__(self, connection: dict):
def __init__(self, connection: dict, log = False):
aadityasinha-dotcom marked this conversation as resolved.
Show resolved Hide resolved
super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__)
aadityasinha-dotcom marked this conversation as resolved.
Show resolved Hide resolved
self._default_headers["Accept-Encoding"] = "gzip"

Expand Down
2 changes: 1 addition & 1 deletion src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Jobs(SdkApi):
A profile for connection in dict (json) format
"""

def __init__(self, connection: dict):
def __init__(self, connection: dict, log = False):
super().__init__(connection, "/zosmf/restjobs/jobs/", logger_name=__name__)

def get_job_status(self, jobname: str, jobid: str) -> JobResponse:
Expand Down
2 changes: 1 addition & 1 deletion src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Tso(SdkApi):
Profile used for tso connection
"""

def __init__(self, connection: dict, tso_profile: Optional[dict] = None):
def __init__(self, connection: dict, tso_profile: Optional[dict] = None, log = False):
super().__init__(connection, "/zosmf/tsoApp/tso", logger_name=__name__)
self.session_not_found = constants["TsoSessionNotFound"]
self.tso_profile = tso_profile or {}
Expand Down
2 changes: 1 addition & 1 deletion src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Zosmf(SdkApi):
The z/OSMF connection object (generated by the ZoweSDK object)
"""

def __init__(self, connection: dict):
def __init__(self, connection: dict, log = False):
super().__init__(connection, "/zosmf/info", logger_name=__name__)

def get_info(self) -> ZosmfResponse:
Expand Down
Loading