Skip to content

Commit 6ae53d8

Browse files
martygrantkbenzie
andcommitted
[UR] Added new output sink to the logger which is a user configurable callback function. Configurable through two new entry points with adapter implementations: urAdapterSetLoggerCallback() and urAdapterSetLoggerCallbackLevel(). Moved logger::level enum to the spec, named ur_logger_level_t. Added new unit test suite for these entry points.
Co-authored-by: Kenneth Benzie (Benie) <[email protected]>
1 parent 585606a commit 6ae53d8

40 files changed

+1594
-319
lines changed

unified-runtime/include/ur_api.h

Lines changed: 98 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unified-runtime/include/ur_api_funcs.def

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unified-runtime/include/ur_ddi.h

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unified-runtime/include/ur_print.h

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unified-runtime/include/ur_print.hpp

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unified-runtime/scripts/core/INTRO.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ By default, no messages are printed.
202202

203203
By default, there is a guarantee that *error* messages are flushed immediately. One can change this behavior to flush on lower-level messages.
204204

205-
Loggers redirect messages to *stdout*, *stderr*, or a file (default: *stderr*).
205+
Loggers redirect messages to *stdout*, *stderr*, a file, or a user configurable callback function (default: *stderr*).
206206

207-
All of these logging options can be set with **UR_LOG_LOADER** and **UR_LOG_NULL** environment variables described in the **Environment Variables** section below.
207+
All of these logging options (except the callback) can be set with **UR_LOG_LOADER** and **UR_LOG_NULL** environment variables described in the **Environment Variables** section below.
208208
Both of these environment variables have the same syntax for setting logger options:
209209

210210
"[level:debug|info|warning|error];[flush:<debug|info|warning|error>];[output:stdout|stderr|file,<path>]"
@@ -232,6 +232,10 @@ An example of an environment variable for setting up the null adapter library wi
232232

233233
UR_LOG_NULL="level:warning;output:stdout"
234234

235+
Logging callback
236+
^^^^^^^^^^^^^^^^^^^^^
237+
An API is available to configure the logging callback function :ref:`urAdapterSetLoggerCallback`. Additionally, the logging level can be set using :ref:`urAdapterSetLoggerCallbackLevel`.
238+
235239
Adapter Discovery
236240
---------------------
237241
UR is capable of discovering adapter libraries in the following ways in the listed order:

0 commit comments

Comments
 (0)