Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing system log #1468

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions mxcubeweb/logging_handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import traceback


class MX3LoggingHandler(logging.handlers.BufferingHandler):
Expand All @@ -13,10 +12,6 @@ def connect():
pass

def _record_to_json(self, record):
if record.exc_info:
stack_trace = "".join(traceback.format_exception(*record.exc_info))
else:
stack_trace = ""
try:
record.asctime
except AttributeError:
Expand All @@ -26,14 +21,10 @@ def _record_to_json(self, record):
"message": record.getMessage(),
"severity": record.levelname,
"timestamp": record.asctime,
"logger": record.name,
"stack_trace": stack_trace,
Comment on lines -29 to -30
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the logger and stack_trace from the LoggingHandler, as we only need the user_level_log to be shown in the UI and due to some concerns about the stack_trace being sent to the front-end in #1393. Could this removal be confirmed as accepted or is the general opinion to keep it?

}

def emit(self, record):
if record.name != "geventwebsocket.handler":
if record.name == "user_level_log":
record_dict = self._record_to_json(record)
super().emit(record_dict)
self.server.emit("log_record", record_dict, namespace="/logging")
else:
super().emit(record)
4 changes: 0 additions & 4 deletions ui/src/actions/logger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export function addLogRecord(data) {
return { type: 'ADD_LOG_RECORD', data };
}

export function setLogPage(page) {
return { type: 'SET_PAGE_LOGGING', page };
}
5 changes: 0 additions & 5 deletions ui/src/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import LoginContainer from '../containers/LoginContainer';
import SampleViewContainer from '../containers/SampleViewContainer';
import SampleListViewContainer from '../containers/SampleListViewContainer';
import EquipmentContainer from '../containers/EquipmentContainer';
import LoggerContainer from '../containers/LoggerContainer';
import RemoteAccessContainer from '../containers/RemoteAccessContainer';
import HelpContainer from '../containers/HelpContainer';
import Main from './Main';
Expand Down Expand Up @@ -48,10 +47,6 @@ const router = createBrowserRouter([
path: 'equipment',
element: <EquipmentContainer />,
},
{
path: 'logging',
element: <LoggerContainer />,
},
{
path: 'remoteaccess',
element: <RemoteAccessContainer />,
Expand Down
3 changes: 0 additions & 3 deletions ui/src/components/MXNavbar/MXNavbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ function MXNavbar() {
<Nav.Link as={NavLink} className={styles.navLink} to="/equipment">
Equipment
</Nav.Link>
<Nav.Link as={NavLink} className={styles.navLink} to="/logging">
System log
</Nav.Link>
</Nav>
<Nav className={styles.subNav}>
<Nav.Link as={NavLink} className={styles.navLink} to="/help">
Expand Down
5 changes: 0 additions & 5 deletions ui/src/components/Notify/UserMessage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ export default class UserMessage extends React.Component {
include = false;
}

// Message is not for this component, skip !
if (this.props.target && this.props.target !== message.logger) {
include = false;
}

// Filter function returns true for messages to exclude, skip !
if (this.props.filter && this.props.filter(message)) {
include = false;
Expand Down
104 changes: 0 additions & 104 deletions ui/src/containers/LoggerContainer.jsx

This file was deleted.

5 changes: 1 addition & 4 deletions ui/src/containers/SampleQueueContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,7 @@ class SampleQueueContainer extends React.Component {
/>
Log messages:
</div>
<UserMessage
messages={this.props.logRecords}
target="user_level_log"
/>
<UserMessage messages={this.props.logRecords} />
</div>
</div>
</div>
Expand Down
4 changes: 0 additions & 4 deletions ui/src/reducers/logger.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const INITIAL_STATE = {
logRecords: [],
activePage: 0,
};

function loggerReducer(state = INITIAL_STATE, action = {}) {
Expand All @@ -11,9 +10,6 @@ function loggerReducer(state = INITIAL_STATE, action = {}) {
logRecords: [...state.logRecords.slice(-100), action.data],
};
}
case 'SET_PAGE_LOGGING': {
return { ...state, activePage: action.page };
}
case 'SET_INITIAL_STATE': {
return { ...state, logRecords: [...action.data.logger] };
}
Expand Down
Loading