Skip to content

Feat/remove logging by default#131

Merged
vinitkumar merged 5 commits into
masterfrom
feat/remove-logging-by-default
May 6, 2022
Merged

Feat/remove logging by default#131
vinitkumar merged 5 commits into
masterfrom
feat/remove-logging-by-default

Conversation

@vinitkumar

@vinitkumar vinitkumar commented May 6, 2022

Copy link
Copy Markdown
Owner

Disable logging in the consumers by default.

Vinit Kumar added 2 commits May 6, 2022 21:26
Library shouldn't be emitting logs by default and not pollute the
consumers. Hence, we put the LOGS behind a flag.

To see the library's logs, set DEBUGMODE=True in environment for the
logs to work. DEBUGMODE is a fairly unique env variable so should do
do the trick.

- Github Issue: #130

Reported-by: https://github.com/ricciarellif

Authored-by: Vinit Kumar <vinit.kumar@kidskonnect.nl>
Signed-off-by: Vinit Kumar <vinit.kumar@kidskonnect.nl>
@vinitkumar vinitkumar linked an issue May 6, 2022 that may be closed by this pull request
@codecov-commenter

codecov-commenter commented May 6, 2022

Copy link
Copy Markdown

Codecov Report

Merging #131 (45a1c3e) into master (7826a64) will increase coverage by 0.91%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #131      +/-   ##
==========================================
+ Coverage   91.28%   92.19%   +0.91%     
==========================================
  Files           5        5              
  Lines         459      423      -36     
==========================================
- Hits          419      390      -29     
+ Misses         40       33       -7     
Impacted Files Coverage Δ
tests/test_json2xml.py 99.35% <ø> (-0.05%) ⬇️
json2xml/dicttoxml.py 87.56% <100.00%> (+1.72%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7826a64...45a1c3e. Read the comment docs.

@vinitkumar vinitkumar merged commit a25dee6 into master May 6, 2022
@vinitkumar vinitkumar deleted the feat/remove-logging-by-default branch May 6, 2022 16:22
@ricciarellif

ricciarellif commented May 6, 2022

Copy link
Copy Markdown

FYI, I did not make any branch of your project: I've done a pip install and used the library with an import.
Here is my implementation:

import json
from json2xml import json2xml
from json2xml.utils import readfromstring  # , readfromurl, readfromjson


def dict2xml(inputDataListOrDict: any, rootElement: str = '') -> str:
    """
    dict2xml - Trasforma un dizionario Python in XML (DICT -> JSON string -> XML)
    :param inputDataListOrDict: dict or list, il dizionario o la lista dei dizionari da convertire in XML
    :param rootElement: str, il nome del nodo root
    
    :returns: str, il file xml convertito
    """
    returnValue: str = ''
    if inputDataListOrDict:
        data = readfromstring(json.dumps(inputDataListOrDict))  # function "readfromstring" returns dict, not string! See: def readfromstring(jsondata: str) -> dict[str, str]
        xmlIdsAndFlags = json2xml.Json2xml(data, wrapper=rootElement, item_wrap=True, attr_type=False).to_xml()  # data: Expected type 'str', got 'dict[str, str]' instead 
        returnValue = xmlIdsAndFlags.replace('<?xml version="1.0" ?>\n', '')

    return returnValue

@vinitkumar

Copy link
Copy Markdown
Owner Author

@ricciarellif Alright, maybe I was not clear. Anyways. I did fix the issue and did release on https://pypi.org/project/json2xml/3.19.0rc1/

So please install from pip like this:

pip install json2xml==3.19.0rc1 and do your tests again, you shouldn't see any unwanted logs anymore.

Please mind that this is a release candidate and not the final release, so please don't use this version in production yet.

@vinitkumar vinitkumar restored the feat/remove-logging-by-default branch June 14, 2026 17:18
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.

Logging should be disabled by default

3 participants