Skip to content

Commit

Permalink
Update to 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MasatoKokubo committed Mar 31, 2024
1 parent b3a0785 commit b8127b6
Show file tree
Hide file tree
Showing 10 changed files with 252 additions and 196 deletions.
12 changes: 6 additions & 6 deletions Examples/readme_example.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# readme_example.py
import datetime
import debugtrace # TODO: Remove after debugging
import debugtrace

class Contact(object):
def __init__(self, id: int, firstName: str, lastName: str, birthday: datetime.date) -> None:
_ = debugtrace.enter(self) # TODO: Remove after debugging
_ = debugtrace.enter(self)
self.id = id
self.firstName = firstName
self.lastName = lastName
self.birthday = birthday

def func2():
_ = debugtrace.enter() # TODO: Remove after debugging
_ = debugtrace.enter()
contacts = [
Contact(1, 'Akane' , 'Apple', datetime.date(1991, 2, 3)),
Contact(2, 'Yukari', 'Apple', datetime.date(1992, 3, 4))
]
debugtrace.print('contacts', contacts) # TODO: Remove after debugging
debugtrace.print('contacts', contacts)

def func1():
_ = debugtrace.enter() # TODO: Remove after debugging
debugtrace.print('Hello, World!') # TODO: Remove after debugging
_ = debugtrace.enter()
debugtrace.print('Hello, World!')
func2()

func1()
7 changes: 3 additions & 4 deletions Examples/thread_example.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# thread_example.py
import threading
import time
import debugtrace # TODO: Remove after debugging
import debugtrace

def aThread(index: int):
_ = debugtrace.enter() # TODO: Remove after debugging
_ = debugtrace.enter()
debugtrace.print('index', index)
debugtrace.print('ident', threading.get_ident())
# debugtrace.print('native_id', threading.get_native_id())
debugtrace.print('before sleep')
time.sleep(1)
debugtrace.print('after sleep')

def main():
_ = debugtrace.enter() # TODO: Remove after debugging
_ = debugtrace.enter()
threadCount = 4
threads = []
for index in range(threadCount):
Expand Down
115 changes: 60 additions & 55 deletions Package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,61 +34,61 @@ The following is an example of a Python program using DebugTrace-py and a log wh
```python:readme_example.py
# readme_example.py
import datetime
import debugtrace # TODO: Remove after debugging
import debugtrace

# Contact class
class Contact(object):
def __init__(self, id: int, firstName: str, lastName: str, birthday: datetime.date) -> None:
_ = debugtrace.enter(self) # TODO: Remove after debugging
_ = debugtrace.enter(self)
self.id = id
self.firstName = firstName
self.lastName = lastName
self.birthday = birthday

def func2():
_ = debugtrace.enter() # TODO: Remove after debugging
_ = debugtrace.enter()
contact = [
Contact(1, 'Akane' , 'Apple', datetime.date(1991, 2, 3)),
Contact(2, 'Yukari', 'Apple', datetime.date(1992, 3, 4))
]
debugtrace.print('contact', contact) # TODO: Remove after debugging
debugtrace.print('contact', contact)

def func1():
_ = debugtrace.enter() # TODO: Remove after debugging
debugtrace.print('Hello, World!') # TODO: Remove after debugging
_ = debugtrace.enter()
debugtrace.print('Hello, World!')
func2()

func1()
```

Log output contents:
```log
2023-02-26 21:05:06.623919+0900 DebugTrace-py 1.3.0 on Python 3.11.0
2023-02-26 21:05:06.623973+0900 config file path: <No config file>
2023-02-26 21:05:06.623990+0900 logger: sys.stderr
2023-02-26 21:05:06.624044+0900
2023-02-26 21:05:06.624091+0900 ______________________________ MainThread #140621580739648 ______________________________
2023-02-26 21:05:06.624106+0900
2023-02-26 21:05:06.625608+0900 Enter func1 (readme_example.py:22) <- (readme_example.py:26)
2023-02-26 21:05:06.625701+0900 | Hello, World! (readme_example.py:23)
2023-02-26 21:05:06.625806+0900 | Enter func2 (readme_example.py:14) <- (readme_example.py:24)
2023-02-26 21:05:06.625902+0900 | | Enter Contact.__init__ (readme_example.py:7) <- (readme_example.py:16)
2023-02-26 21:05:06.625964+0900 | | Leave Contact.__init__ (readme_example.py:7) duration: 0:00:00.000008
2023-02-26 21:05:06.626055+0900 | |
2023-02-26 21:05:06.626091+0900 | | Enter Contact.__init__ (readme_example.py:7) <- (readme_example.py:17)
2023-02-26 21:05:06.626123+0900 | | Leave Contact.__init__ (readme_example.py:7) duration: 0:00:00.000005
2023-02-26 21:05:06.627114+0900 | |
2023-02-26 21:05:06.627155+0900 | | contacts = [
2023-02-26 21:05:06.627190+0900 | | (__main__.Contact){
2023-02-26 21:05:06.627218+0900 | | birthday: 1991-02-03, firstName: 'Akane', id: 1, lastName: 'Apple'
2023-02-26 21:05:06.627235+0900 | | },
2023-02-26 21:05:06.627246+0900 | | (__main__.Contact){
2023-02-26 21:05:06.627257+0900 | | birthday: 1992-03-04, firstName: 'Yukari', id: 2, lastName: 'Apple'
2023-02-26 21:05:06.627279+0900 | | }
2023-02-26 21:05:06.627314+0900 | | ] (readme_example.py:19)
2023-02-26 21:05:06.627348+0900 | |
2023-02-26 21:05:06.627390+0900 | Leave func2 (readme_example.py:14) duration: 0:00:00.001537
2023-02-26 21:05:06.627430+0900 Leave func1 (readme_example.py:22) duration: 0:00:00.001769
2024-03-29 18:43:38.112156+0900 DebugTrace-py 1.4.0 on Python 3.12.0
2024-03-29 18:43:38.112209+0900 config file path: <No config file>
2024-03-29 18:43:38.112244+0900 logger: sys.stderr
2024-03-29 18:43:38.112329+0900
2024-03-29 18:43:38.112367+0900 ______________________________ MainThread #134705475060800 ______________________________
2024-03-29 18:43:38.112384+0900
2024-03-29 18:43:38.113719+0900 Enter func1 (readme_example.py:22) <- (readme_example.py:26)
2024-03-29 18:43:38.113813+0900 | Hello, World! (readme_example.py:23)
2024-03-29 18:43:38.113907+0900 | Enter func2 (readme_example.py:14) <- (readme_example.py:24)
2024-03-29 18:43:38.114001+0900 | | Enter Contact.__init__ (readme_example.py:7) <- (readme_example.py:16)
2024-03-29 18:43:38.114074+0900 | | Leave Contact.__init__ (readme_example.py:7) duration: 0:00:00.000008
2024-03-29 18:43:38.114166+0900 | |
2024-03-29 18:43:38.114202+0900 | | Enter Contact.__init__ (readme_example.py:7) <- (readme_example.py:17)
2024-03-29 18:43:38.114240+0900 | | Leave Contact.__init__ (readme_example.py:7) duration: 0:00:00.000007
2024-03-29 18:43:38.114534+0900 | |
2024-03-29 18:43:38.114574+0900 | | contacts = [
2024-03-29 18:43:38.114596+0900 | | (__main__.Contact){
2024-03-29 18:43:38.114609+0900 | | birthday: 1991-02-03, firstName: 'Akane', id: 1, lastName: 'Apple'
2024-03-29 18:43:38.114646+0900 | | },
2024-03-29 18:43:38.114703+0900 | | (__main__.Contact){
2024-03-29 18:43:38.114727+0900 | | birthday: 1992-03-04, firstName: 'Yukari', id: 2, lastName: 'Apple'
2024-03-29 18:43:38.114738+0900 | | }
2024-03-29 18:43:38.114748+0900 | | ] (readme_example.py:19)
2024-03-29 18:43:38.114778+0900 | |
2024-03-29 18:43:38.114818+0900 | Leave func2 (readme_example.py:14) duration: 0:00:00.000863
2024-03-29 18:43:38.114859+0900 Leave func1 (readme_example.py:22) duration: 0:00:00.001086
```

## 4. Functions
Expand All @@ -110,11 +110,9 @@ There are mainly the following functions.
</ul>
<i>Examples:</i><br>
<ul>
<code>
_ = debugtrace.enter(self)<br>
_ = debugtrace.enter(cls)<br>
_ = debugtrace.enter()
</code>
<code> _ = debugtrace.enter(self)<br>
_ = debugtrace.enter(cls)<br>
_ = debugtrace.enter()</code>
</ul>
</td>
</tr>
Expand All @@ -132,18 +130,16 @@ There are mainly the following functions.
<code><b>force_reflection</b> (bool, optional)</code>: If <code>True</code>, outputs using reflection even if it has a <code>__str__</code> or <code>__repr__</code> method (default: <code>False</code>)<br>
<code><b>output_private</b> (bool, optional)</code>: If <code>True</code>, also outputs private members when using reflection (default: <code>False</code>)<br>
<code><b>output_method</b> (bool, optional)</code>: If <code>True</code>, also outputs method members when using reflection (default: <code>False</code>)<br>
<code><b>collection_limit</b> (int, optional)</code>: The limit value of elements such as <code>list</code>, <code>tuple</code> and <code>dict</code> to output (default: <code>None</code>)<br>
<code><b>bytes_limit</b> (int, optional)</code>: The limit value of elements for <code>bytes</code> and <code>bytearray</code> to output (default: <code>None</code>)<br>
<code><b>string_limit</b> (int, optional)</code>: The limit value of characters for string to output (default: <code>None</code>)<br>
<code><b>reflection_nest_limit</b> (int, optional)</code>: The The limit value for reflection nesting (default: <code>None</code>)<br>
<code><b>collection_limit</b> (int, optional)</code>: The limit value of elements such as <code>list</code>, <code>tuple</code> and <code>dict</code> to output (default: <code>-1</code>)<br>
<code><b>bytes_limit</b> (int, optional)</code>: The limit value of elements for <code>bytes</code> and <code>bytearray</code> to output (default: <code>-1</code>)<br>
<code><b>string_limit</b> (int, optional)</code>: The limit value of characters for string to output (default: <code>-1</code>)<br>
<code><b>reflection_nest_limit</b> (int, optional)</code>: The The limit value for reflection nesting (default: <code>-1</code>)<br>
<br>
<i>Examples:</i><br>
<code>
debugtrace.print('Hellow')<br>
debugtrace.print('foo', foo)<br>
debugtrace.print('foo', foo, force_reflection=<code>True</code>)<br>
debugtrace.print('foos', foos, collection_limit=1024)
</code>
<code> debugtrace.print('Hellow')<br>
debugtrace.print('foo', foo)<br>
debugtrace.print('foo', foo, force_reflection=<code>True</code>)<br>
debugtrace.print('foos', foos, collection_limit=1024)</code>
</td>
</tr>
</table>
Expand Down Expand Up @@ -281,7 +277,7 @@ You can specify the following options in the `debugtrace.ini` file.
<td>
The minimum value to output the number of elements for <code>list</code>, <code>tuple</code> and <code>dict</code>
</td>
<td>16</td>
<td>128</td>
</tr>
<tr>
<td><code>length_format</code></td>
Expand All @@ -291,7 +287,7 @@ You can specify the following options in the `debugtrace.ini` file.
<tr>
<td><code>minimum_output_length</code></td>
<td>The minimum value to output the length of string and <code>bytes</code></td>
<td>16</td>
<td>256</td>
</tr>
<tr>
<td><code>log_datetime_format</code></td>
Expand All @@ -316,13 +312,13 @@ You can specify the following options in the `debugtrace.ini` file.
<td>128</td>
</tr>
<tr>
<td><code>string_limit</code></td>
<td>The limit value of characters for string to output</td>
<td><code>bytes_limit</code></td>
<td>The limit value of elements for <code>bytes</code> and <code>bytearray</code> to output</td>
<td>256</td>
</tr>
<tr>
<td><code>bytes_limit</code></td>
<td>The limit value of elements for <code>bytes</code> and <code>bytearray</code> to output</td>
<td><code>string_limit</code></td>
<td>The limit value of characters for string to output</td>
<td>256</td>
</tr>
<tr>
Expand All @@ -342,6 +338,16 @@ You can specify the following options in the `debugtrace.ini` file.

## 7. Release notes

### DebugTrace-py 1.4.0 - March 31, 2024

* `print` method now returns the `value` of the argument.
* Changed default values for the following properties.

|Property Name|New Default Value|Old Default Value|
|:------------|:---------------:|:---------------:|
|minimum_output_count |128|16|
|minimum_output_length|256|16|

### DebugTrace-py 1.3.0 - March 4, 2023

* Added calling source file name and line number to log output of `enter` method.
Expand All @@ -359,8 +365,8 @@ You can specify the following options in the `debugtrace.ini` file.
|minimum_output_count | 16| 5|
|minimum_output_length| 16| 5|
|collection_limit |128| 512|
|string_limit |256|8192|
|bytes_limit |256|8192|
|string_limit |256|8192|

### DebugTrace-py 1.1.0 - November 28, 2021

Expand Down Expand Up @@ -389,4 +395,3 @@ You can specify the following options in the `debugtrace.ini` file.
### DebugTrace-py 1.0.0 - May 26, 2020

* First release

Loading

0 comments on commit b8127b6

Please sign in to comment.