Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function activateLogConsole(
app: JupyterFrontEnd,
labShell: ILabShell,
rendermime: IRenderMimeRegistry,
nbtracker: INotebookTracker,
palette: ICommandPalette | null,
restorer: ILayoutRestorer | null,
mainMenu: IMainMenu | null,
settingRegistry: ISettingRegistry | null,
statusBar: IStatusBar | null
): ILoggerRegistry {
let logConsoleWidget: MainAreaWidget = null;
let logConsolePanel: LogConsolePanel = null;
const loggerRegistry = new LoggerRegistry({
defaultRendermime: rendermime,
// The maxLength is reset below from settings
maxLength: 1000
});
const tracker = new WidgetTracker>({
namespace: 'logconsole'
});
if (restorer) {
void restorer.restore(tracker, {
command: CommandIDs.open,
name: () => 'logconsole'
});
}
function activateLogConsole(
app: JupyterFrontEnd,
labShell: ILabShell,
rendermime: IRenderMimeRegistry,
nbtracker: INotebookTracker,
palette: ICommandPalette | null,
restorer: ILayoutRestorer | null,
mainMenu: IMainMenu | null,
settingRegistry: ISettingRegistry | null,
statusBar: IStatusBar | null
): ILoggerRegistry {
let logConsoleWidget: MainAreaWidget = null;
let logConsolePanel: LogConsolePanel = null;
const loggerRegistry = new LoggerRegistry({
defaultRendermime: rendermime,
// The maxLength is reset below from settings
maxLength: 1000
});
const tracker = new WidgetTracker>({
namespace: 'logconsole'
});
if (restorer) {
void restorer.restore(tracker, {
command: CommandIDs.open,
name: () => 'logconsole'
});
}
it('should set the max length', async () => {
const model = new LoggerOutputAreaModel({ maxLength: 10 });
expect(model.maxLength).toEqual(10);
model.dispose();
});
});
beforeEach(() => {
defaultRendermime = new RenderMimeRegistry({ initialFactories });
registry = new LoggerRegistry({
defaultRendermime,
maxLength: 10
});
logConsole = new LogConsolePanel(registry);
});
afterEach(() => {
beforeEach(() => {
defaultRendermime = new RenderMimeRegistry();
registry = new LoggerRegistry({
defaultRendermime,
maxLength: 10
});
});
beforeEach(() => {
defaultRendermime = new RenderMimeRegistry({ initialFactories });
registry = new LoggerRegistry({
defaultRendermime,
maxLength: 10
});
logConsole = new LogConsolePanel(registry);
});
afterEach(() => {
beforeEach(() => {
model = new LoggerOutputAreaModel({ maxLength: 10 });
});
afterEach(() => {
beforeEach(() => {
logger = new Logger({ source: 'test source', maxLength: 10 });
});
afterEach(() => {
const createLogConsoleWidget = (options: ILogConsoleOptions = {}) => {
logConsolePanel = new LogConsolePanel(loggerRegistry);
logConsolePanel.source =
options.source !== undefined
? options.source
: nbtracker.currentWidget
? nbtracker.currentWidget.context.path
: null;
logConsoleWidget = new MainAreaWidget({ content: logConsolePanel });
logConsoleWidget.addClass('jp-LogConsole');
logConsoleWidget.title.closable = true;
logConsoleWidget.title.label = 'Log Console';
logConsoleWidget.title.iconClass = 'jp-LogConsoleIcon';
const addCheckpointButton = new CommandToolbarButton({
commands: app.commands,
const createLogConsoleWidget = (options: ILogConsoleOptions = {}) => {
logConsolePanel = new LogConsolePanel(loggerRegistry);
logConsolePanel.source =
options.source !== undefined
? options.source
: nbtracker.currentWidget
? nbtracker.currentWidget.context.path
: null;
logConsoleWidget = new MainAreaWidget({ content: logConsolePanel });
logConsoleWidget.addClass('jp-LogConsole');
logConsoleWidget.title.closable = true;
logConsoleWidget.title.label = 'Log Console';
logConsoleWidget.title.iconClass = 'jp-ListIcon';
const addCheckpointButton = new CommandToolbarButton({
commands: app.commands,