|
54 | 54 | "name": "stdout",
|
55 | 55 | "output_type": "stream",
|
56 | 56 | "text": [
|
57 |
| - "Validator class: Draft7Validator\n", |
58 |
| - "Schema: {\n", |
59 |
| - " \"$id\": \"myapplication.org/example-event\",\n", |
| 57 | + "{\n", |
| 58 | + " \"$id\": \"http://myapplication.org/example-event\",\n", |
60 | 59 | " \"version\": 1,\n",
|
61 | 60 | " \"title\": \"Example Event\",\n",
|
62 | 61 | " \"description\": \"An interesting event to collect\",\n",
|
|
125 | 124 | "name": "stderr",
|
126 | 125 | "output_type": "stream",
|
127 | 126 | "text": [
|
128 |
| - "{\"__timestamp__\": \"2022-08-11T22:46:22.248281Z\", \"__schema__\": \"myapplication.org/example-event\", \"__schema_version__\": 1, \"__metadata_version__\": 1, \"name\": \"My Event\"}\n" |
| 127 | + "{\"__timestamp__\": \"2024-05-04T23:22:40.338884+00:00Z\", \"__schema__\": \"http://myapplication.org/example-event\", \"__schema_version__\": 1, \"__metadata_version__\": 1, \"name\": \"My Event\"}\n" |
129 | 128 | ]
|
130 | 129 | },
|
131 | 130 | {
|
132 | 131 | "data": {
|
133 | 132 | "text/plain": [
|
134 |
| - "{'__timestamp__': '2022-08-11T22:46:22.248281Z',\n", |
135 |
| - " '__schema__': 'myapplication.org/example-event',\n", |
| 133 | + "{'__timestamp__': '2024-05-04T23:22:40.338884+00:00Z',\n", |
| 134 | + " '__schema__': 'http://myapplication.org/example-event',\n", |
136 | 135 | " '__schema_version__': 1,\n",
|
137 | 136 | " '__metadata_version__': 1,\n",
|
138 | 137 | " 'name': 'My Event'}"
|
|
144 | 143 | }
|
145 | 144 | ],
|
146 | 145 | "source": [
|
147 |
| - "logger.emit(schema_id=\"myapplication.org/example-event\", data={\"name\": \"My Event\"})" |
| 146 | + "logger.emit(schema_id=\"http://myapplication.org/example-event\", data={\"name\": \"My Event\"})" |
148 | 147 | ]
|
149 | 148 | },
|
150 | 149 | {
|
|
160 | 159 | "metadata": {},
|
161 | 160 | "outputs": [],
|
162 | 161 | "source": [
|
163 |
| - "def my_listener(data):\n", |
164 |
| - " print(\"hello, from my_listener!\")\n", |
| 162 | + "async def my_listener(logger: EventLogger, schema_id: str, data: dict) -> None:\n", |
| 163 | + " print(\"hello, from my_listener\")\n", |
| 164 | + " print(logger)\n", |
| 165 | + " print(schema_id)\n", |
165 | 166 | " print(data)\n",
|
166 | 167 | "\n",
|
167 | 168 | "\n",
|
168 |
| - "logger.add_listener(schema_id=\"myapplication.org/example-event\", version=1, listener=my_listener)" |
| 169 | + "logger.add_listener(schema_id=\"http://myapplication.org/example-event\", listener=my_listener)" |
169 | 170 | ]
|
170 | 171 | },
|
171 | 172 | {
|
|
184 | 185 | "name": "stderr",
|
185 | 186 | "output_type": "stream",
|
186 | 187 | "text": [
|
187 |
| - "{\"__timestamp__\": \"2022-08-11T22:46:28.947996Z\", \"__schema__\": \"myapplication.org/example-event\", \"__schema_version__\": 1, \"__metadata_version__\": 1, \"name\": \"My Event\"}\n" |
188 |
| - ] |
189 |
| - }, |
190 |
| - { |
191 |
| - "name": "stdout", |
192 |
| - "output_type": "stream", |
193 |
| - "text": [ |
194 |
| - "hello world\n", |
195 |
| - "EventListenerData(event_logger=<jupyter_events.logger.EventLogger object at 0x7fd07085dfd0>, schema_id='myapplication.org/example-event', version=1, data={'name': 'My Event'})\n", |
196 |
| - "hello world\n", |
197 |
| - "EventListenerData(event_logger=<jupyter_events.logger.EventLogger object at 0x7fd07085dfd0>, schema_id='myapplication.org/example-event', version=1, data={'name': 'My Event'})\n" |
| 188 | + "{\"__timestamp__\": \"2024-05-04T23:22:40.400243+00:00Z\", \"__schema__\": \"http://myapplication.org/example-event\", \"__schema_version__\": 1, \"__metadata_version__\": 1, \"name\": \"My Event\"}\n" |
198 | 189 | ]
|
199 | 190 | },
|
200 | 191 | {
|
201 | 192 | "data": {
|
202 | 193 | "text/plain": [
|
203 |
| - "{'__timestamp__': '2022-08-11T22:46:28.947996Z',\n", |
204 |
| - " '__schema__': 'myapplication.org/example-event',\n", |
| 194 | + "{'__timestamp__': '2024-05-04T23:22:40.400243+00:00Z',\n", |
| 195 | + " '__schema__': 'http://myapplication.org/example-event',\n", |
205 | 196 | " '__schema_version__': 1,\n",
|
206 | 197 | " '__metadata_version__': 1,\n",
|
207 | 198 | " 'name': 'My Event'}"
|
|
210 | 201 | "execution_count": 7,
|
211 | 202 | "metadata": {},
|
212 | 203 | "output_type": "execute_result"
|
| 204 | + }, |
| 205 | + { |
| 206 | + "name": "stdout", |
| 207 | + "output_type": "stream", |
| 208 | + "text": [ |
| 209 | + "hello, from my_listener\n", |
| 210 | + "<jupyter_events.logger.EventLogger object at 0x7f2fa6cd35b0>\n", |
| 211 | + "http://myapplication.org/example-event\n", |
| 212 | + "{'name': 'My Event'}\n" |
| 213 | + ] |
213 | 214 | }
|
214 | 215 | ],
|
215 | 216 | "source": [
|
216 |
| - "logger.emit(schema_id=\"myapplication.org/example-event\", version=1, data={\"name\": \"My Event\"})" |
| 217 | + "logger.emit(schema_id=\"http://myapplication.org/example-event\", data={\"name\": \"My Event\"})" |
217 | 218 | ]
|
218 | 219 | },
|
219 | 220 | {
|
|
0 commit comments