Permalink
Browse files

more log cleanup (#479)

  • Loading branch information...
eanders-MS committed May 7, 2018
1 parent bfa7fcd commit 8c415761de0905653720c18247601a526f12284d
@@ -320,25 +320,15 @@ class LogEntry extends React.Component<LogEntryProps> {
}
if (obj) {
return (
<>
<span key={ key } className="spaced level-0">
<a onClick={ () => this.inspect(obj) }>{ statusCode }</a>
</span>
<span key={ `${key}-0` } className="spaced level-0">
{ statusMessage }
</span>
</>
<span key={ key } className="spaced level-0">
<a onClick={ () => this.inspect(obj) }>{ statusCode }</a>
</span>
);
} else {
return (
<>
<span key={ key } className="spaced level-0">
{ statusCode }
</span>
<span key={ `${key}-0` } className="spaced level-0">
{ statusMessage }
</span>
</>
<span key={ key } className="spaced level-0">
{ statusCode }
</span>
);
}
}
@@ -77,22 +77,15 @@ export class RestServer {
return;
}
const reqBody = req.body;
//const resBody = res;
//console.log('after', req.method, route.spec.path, error);
const facility = req['facility'] || 'network';
const routeName = req['routeName'] || '';
let level = LogLevel.Info;
if (!/2\d\d/.test(res.statusCode.toString()))
level = LogLevel.Error;
let trailing = route.spec.path.toString();
if (trailing.length > 30)
trailing = `...${trailing.substr(-30)}`;
mainWindow.logService.logToChat(
conversationId,
textItem(
LogLevel.Info,
`[${facility}]`
),
networkRequestItem(
facility,
(req as any)._body,
@@ -108,8 +101,8 @@ export class RestServer {
req.url
),
textItem(
LogLevel.Debug,
trailing
level,
`${facility}.${routeName}`
),
);
});
@@ -35,6 +35,7 @@ import { RequestHandlerType, Server } from 'restify';
import BotEmulator from '../botEmulator';
import getFacility from '../middleware/getFacility';
import getRouteName from '../middleware/getRouteName';
import getAttachment from './middleware/getAttachment';
import getAttachmentInfo from './middleware/getAttachmentInfo';
@@ -46,13 +47,15 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
'/v3/attachments/:attachmentId',
...uses,
facility,
getRouteName('getAttachmentInfo'),
getAttachmentInfo(botEmulator)
);
server.get(
'/v3/attachments/:attachmentId/views/:viewId',
...uses,
facility,
getRouteName('getAttachment'),
getAttachment(botEmulator)
);
}
@@ -37,6 +37,7 @@ import BotEmulator from '../botEmulator';
import createBotFrameworkAuthenticationMiddleware from '../utils/botFrameworkAuthentication';
import jsonBodyParser from '../utils/jsonBodyParser';
import getFacility from '../middleware/getFacility';
import getRouteName from '../middleware/getRouteName';
import createFetchBotDataMiddleware from './middleware/fetchBotData';
import getConversationData from './middleware/getConversationData';
@@ -60,6 +61,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
verifyBotFramework,
fetchBotDataMiddleware,
facility,
getRouteName('getUserData'),
getUserData(botEmulator)
);
@@ -69,6 +71,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
verifyBotFramework,
fetchBotDataMiddleware,
facility,
getRouteName('getConversationData'),
getConversationData(botEmulator)
);
@@ -78,6 +81,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
verifyBotFramework,
fetchBotDataMiddleware,
facility,
getRouteName('getPrivateConversationData'),
getPrivateConversationData(botEmulator)
);
@@ -87,6 +91,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
verifyBotFramework,
jsonBodyParser(),
facility,
getRouteName('setUserData'),
setUserData(botEmulator)
);
@@ -96,6 +101,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
verifyBotFramework,
jsonBodyParser(),
facility,
getRouteName('setConversationData'),
setConversationData(botEmulator)
);
@@ -105,6 +111,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
verifyBotFramework,
jsonBodyParser(),
facility,
getRouteName('setPrivateConversationData'),
setPrivateConversationData(botEmulator)
);
@@ -113,6 +120,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
...uses,
verifyBotFramework,
facility,
getRouteName('deleteStateForUser'),
deleteStateForUser(botEmulator)
);
}
@@ -38,6 +38,7 @@ import createBotFrameworkAuthenticationMiddleware from '../utils/botFrameworkAut
import IUser from '../types/user';
import createJsonBodyParser from '../utils/jsonBodyParser';
import getFacility from '../middleware/getFacility';
import getRouteName from '../middleware/getRouteName';
import createConversation from './middleware/createConversation';
import createFetchConversationMiddleware from './middleware/fetchConversation';
@@ -66,6 +67,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
jsonBodyParser,
botEndpoint,
facility,
getRouteName('createConversation'),
createConversation(botEmulator)
);
@@ -76,6 +78,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
jsonBodyParser,
fetchConversation,
facility,
getRouteName('sendToConversation'),
sendToConversation(botEmulator)
);
@@ -86,6 +89,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
jsonBodyParser,
fetchConversation,
facility,
getRouteName('replyToActivity'),
replyToActivity(botEmulator)
);
@@ -96,6 +100,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
jsonBodyParser,
fetchConversation,
facility,
getRouteName('updateActivity'),
updateActivity(botEmulator)
);
@@ -105,6 +110,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
verifyBotFramework,
fetchConversation,
facility,
getRouteName('deleteActivity'),
deleteActivity(botEmulator)
);
@@ -114,6 +120,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
verifyBotFramework,
fetchConversation,
facility,
getRouteName('getConversationMembers'),
getConversationMembers(botEmulator)
);
@@ -123,6 +130,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
verifyBotFramework,
fetchConversation,
facility,
getRouteName('getActivityMembers'),
getActivityMembers(botEmulator)
);
@@ -132,6 +140,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
verifyBotFramework,
jsonBodyParser,
facility,
getRouteName('uploadAttachment'),
uploadAttachment(botEmulator)
);
}
@@ -37,6 +37,7 @@ import { RequestHandler, Server } from 'restify';
import BotEmulator from '../botEmulator';
import createJsonBodyParserMiddleware from '../utils/jsonBodyParser';
import getFacility from '../middleware/getFacility';
import getRouteName from '../middleware/getRouteName';
import getActivities from './middleware/getActivities';
import getBotEndpoint from '../middleware/getBotEndpoint';
@@ -58,6 +59,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
'/v3/directline',
...uses,
facility,
getRouteName('options'),
options(botEmulator)
);
@@ -67,6 +69,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
botEndpoint,
jsonBodyParser,
facility,
getRouteName('startConversation'),
startConversation(botEmulator)
);
@@ -76,6 +79,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
botEndpoint,
conversation,
facility,
getRouteName('reconnectToConversation'),
reconnectToConversation(botEmulator)
);
@@ -85,6 +89,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
botEndpoint,
conversation,
facility,
getRouteName('getActivities'),
getActivities(botEmulator)
);
@@ -95,6 +100,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
botEndpoint,
conversation,
facility,
getRouteName('postActivity'),
postActivity(botEmulator)
);
@@ -104,13 +110,15 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
botEndpoint,
conversation,
facility,
getRouteName('upload'),
upload(botEmulator)
);
server.get(
'/v3/directline/conversations/:conversationId/stream',
...uses,
facility,
getRouteName('stream'),
stream(botEmulator)
);
}
@@ -36,6 +36,7 @@ import BotEmulator from '../botEmulator';
import createFetchConversationMiddleware from './middleware/fetchConversation';
import createJsonBodyParserMiddleware from '../utils/jsonBodyParser';
import getFacility from '../middleware/getFacility';
import getRouteName from '../middleware/getRouteName';
import addUsers from './middleware/addUsers';
import contactAdded from './middleware/contactAdded';
@@ -59,6 +60,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
'/emulator/:conversationId/users',
fetchConversation,
facility,
getRouteName('getUsers'),
getUsers(botEmulator)
);
@@ -67,48 +69,55 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
jsonBodyParser,
fetchConversation,
facility,
getRouteName('addUsers'),
addUsers(botEmulator)
);
server.del(
'/emulator/:conversationId/users',
fetchConversation,
facility,
getRouteName('removeUsers'),
removeUsers(botEmulator)
);
server.post(
'/emulator/:conversationId/contacts',
fetchConversation,
facility,
getRouteName('contactAdded'),
contactAdded(botEmulator)
);
server.del(
'/emulator/:conversationId/contacts',
fetchConversation,
facility,
getRouteName('contactRemoved'),
contactRemoved(botEmulator)
);
server.post(
'/emulator/:conversationId/typing',
fetchConversation,
facility,
getRouteName('typing'),
typing(botEmulator)
);
server.post(
'/emulator/:conversationId/ping',
fetchConversation,
facility,
getRouteName('ping'),
ping(botEmulator)
);
server.del(
'/emulator/:conversationId/userdata',
fetchConversation,
facility,
getRouteName('deleteUserData'),
deleteUserData(botEmulator)
);
@@ -117,6 +126,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
jsonBodyParser,
fetchConversation,
facility,
getRouteName('updateShippingAddress'),
updateShippingAddress(botEmulator)
);
@@ -125,6 +135,7 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
jsonBodyParser,
fetchConversation,
facility,
getRouteName('updateShippingOption'),
updateShippingOption(botEmulator)
);
@@ -133,12 +144,14 @@ export default function registerRoutes(botEmulator: BotEmulator, server: Server,
jsonBodyParser,
fetchConversation,
facility,
getRouteName('paymentComplete'),
paymentComplete(botEmulator)
);
server.post(
'/emulator/:conversationId/invoke/sendTokenResponse',
jsonBodyParser,
facility,
getRouteName('sendTokenResponse'),
sendTokenResponse(botEmulator));
}
Oops, something went wrong.

0 comments on commit 8c41576

Please sign in to comment.