Skip to content

Commit 6a4d00f

Browse files
Update CONTRIBUTING.md
1 parent 32469d2 commit 6a4d00f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

CONTRIBUTING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,41 @@ these steps:
191191
> ```
192192
> The error is related to the `tcl` package. You should uninstall the `tcl`
193193
> package to resolve the error.
194+
195+
## Error handler
196+
197+
Use the `DPCTL_VERBOSITY` environment variable to show errors of different severity levels of the C-API in the console.
198+
You can specify one of the following severity levels (in increasing order of severity): `warning` and `error`.
199+
200+
```bash
201+
export DPCTL_VERBOSITY=error
202+
```
203+
204+
Messages of a given severity are shown not only in the console for that severity, but also for a lower severity.For example, the severity level `error` will output severity errors for `error` and `warning` to the console.
205+
206+
## Google logging libriry (glog)
207+
208+
The dpctl error handler provides logging for exceptions of different severity levels in `libsyclinterface` using the [glog](https://github.com/google/glog) library.
209+
To use logging during development , follow these steps:
210+
211+
1. Install glog package of the latest version (0.5.0)
212+
```bash
213+
conda install glog
214+
```
215+
2. Build dpctl with glog support
216+
```bash
217+
python scripts/build_locally.py --oneapi --glog
218+
```
219+
3. Use `DPCTLService_InitLogger` and `DPCTLService_ShutdownLogger` functions during development to initialize the Google's logging library and de-initialize accordingly
220+
221+
```bash
222+
DPCTLService_InitLogger(const char *app_name, const char *log_dir);
223+
DPCTLService_ShutdownLogger();
224+
```
225+
226+
- `*app_name` - name of the executable file (prefix for logs of various levels).
227+
- `*log_dir` - directory path for writing log files.
228+
229+
> **_NOTE:_**
230+
>
231+
> If `InitGoogleLogging` is not called for initialization, glog will turn into `logtostderr` mode and log files will not be generated.

0 commit comments

Comments
 (0)