Skip to content

Commit

Permalink
added to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sudowoodo200 committed Aug 21, 2023
1 parent d4d656f commit 3fcd997
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ The record will capture information (under the `"payload"` field of the json rec
"name" : "some_function",
...
},
"trace_module": {
"tracer_id": "asdfase-234234sdafs-aerwer",
"thread_id": "default",
"hook_id": "some_function",
...
}
"call_id": "asfda2323-52sdfasd",
"timestamps": {
"start": "2023-08-20 22:05:55.000000",
Expand All @@ -51,7 +57,13 @@ The record will capture information (under the `"payload"` field of the json rec
}
```

This works with functions, methods, classmethods, staticmethods, coroutines, and async generators. If an exception occurs, logging will still happen.
Each record is uniquely identified by 4 fields:
- A `call` is every single run of the `traced function`, identified by a `call_id` field in the logs. Each `call` also defines a `trace_log()` context. (see below)
- A `hook` is a decorator for a specific function, identified by `hook_id`. Functions with hooks are called `traced function`.
- A `thread` is a collection of `hook`'s, identified by the `thread_id` argument while specifying the `hook`
- A `module` is an instance of the `ImpulseTracer` class, identified by the `instance_id` attribute and manages a collection of `threads`

This works with functions, methods, classmethods, staticmethods, coroutines, and async generators. If an exception occurs, logging will still happen.

You can trace nested calls by decorating the relevant functions. For instance:

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "impulse_core"
version = "0.1.1"
version = "0.1.2"
description = ""
authors = ["sudowoodo200 <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 3fcd997

Please sign in to comment.