-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Chuck McAndrew <[email protected]>
- Loading branch information
1 parent
507d1ae
commit d4fcdf2
Showing
6 changed files
with
132 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...les/kubernetes/services/jupyterhub/files/jupyter/jupyter_jupyterlab_pioneer_config.py.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import logging | ||
import json | ||
|
||
|
||
default_log_format = "%(asctime)s %(levelname)9s %(lineno)4s %(module)s: %(message)s" | ||
log_format = ${log_format} | ||
|
||
logging.basicConfig( | ||
level=logging.INFO, | ||
format=log_format if log_format else default_log_format | ||
) | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
CUSTOM_EXPORTER_NAME = "MyCustomExporter" | ||
|
||
|
||
def my_custom_exporter(args): | ||
"""Custom exporter to log JupyterLab events to command line.""" | ||
logger.info(json.dumps(args.get("data"))) | ||
return { | ||
"exporter": CUSTOM_EXPORTER_NAME, | ||
"message": "" | ||
} | ||
|
||
|
||
c.JupyterLabPioneerApp.exporters = [ | ||
{ | ||
# sends telemetry data to the browser console | ||
"type": "console_exporter", | ||
}, | ||
{ | ||
# sends telemetry data (json) to the python console jupyter is running on | ||
"type": "custom_exporter", | ||
"args": { | ||
"id": CUSTOM_EXPORTER_NAME | ||
# add additional args for your exporter function here | ||
}, | ||
} | ||
] | ||
|
||
c.JupyterLabPioneerApp.custom_exporter = { | ||
CUSTOM_EXPORTER_NAME: my_custom_exporter, | ||
} | ||
|
||
c.JupyterLabPioneerApp.activeEvents = [ | ||
{"name": "ActiveCellChangeEvent", "logWholeNotebook": False}, | ||
{"name": "CellAddEvent", "logWholeNotebook": False}, | ||
{"name": "CellEditEvent", "logWholeNotebook": False}, | ||
{"name": "CellExecuteEvent", "logWholeNotebook": False}, | ||
{"name": "CellRemoveEvent", "logWholeNotebook": False}, | ||
{"name": "ClipboardCopyEvent", "logWholeNotebook": False}, | ||
{"name": "ClipboardCutEvent", "logWholeNotebook": False}, | ||
{"name": "ClipboardPasteEvent", "logWholeNotebook": False}, | ||
{"name": "NotebookHiddenEvent", "logWholeNotebook": False}, | ||
{"name": "NotebookOpenEvent", "logWholeNotebook": False}, | ||
{"name": "NotebookSaveEvent", "logWholeNotebook": False}, | ||
{"name": "NotebookScrollEvent", "logWholeNotebook": False}, | ||
{"name": "NotebookVisibleEvent", "logWholeNotebook": False}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters