You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,15 @@ Please note that if `is_supported()` returns `False` then none of the module's o
21
21
22
22
23
23
## Usage
24
-
Pyoslog currently provides the following methods:
24
+
25
+
```python
26
+
import pyoslog
27
+
if pyoslog.is_supported():
28
+
pyoslog.log('This is an OS_LOG_TYPE_DEFAULT message via pyoslog')
29
+
```
30
+
31
+
### Available methods
32
+
Pyoslog provides the following methods from Apple's [unified logging header](https://opensource.apple.com/source/xnu/xnu-3789.21.4/libkern/os/log.h.auto.html):
To configure the Handler's output type, use `handler.setLevel` with a level from the logging module.
85
-
These are mapped internally to the `OS_LOG_TYPE` values – for example, `handler.setLevel(logging.DEBUG)` will configure the Handler to output messages of type `OS_LOG_TYPE_DEBUG`.
91
+
Logger levels are mapped internally to the `OS_LOG_TYPE_*` values – for example, `logger.debug('message')` will generate a message of type `OS_LOG_TYPE_DEBUG`.
86
92
87
93
### Receiving log messages
88
94
Logs can be viewed using Console.app or the `log` command.
@@ -107,7 +113,7 @@ The pyoslog module handles this for you – there is no need to `del` or release
107
113
108
114
109
115
## Limitations
110
-
As noted above, while the macOS `os_log` API allows use of a format string with many methods, this name is required to be a C string literal.
116
+
As noted above, while the macOS `os_log` API allows use of a format string with many methods, this parameter is required to be a C string literal.
111
117
As a result, pyoslog hardcodes all format strings to `"%{public}s"`.
0 commit comments