File tree Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,36 @@ export function round(number, fraction=2) {
48
48
49
49
export const log = console . log
50
50
51
- export function logConnecting ( client , url ) {
52
- log ( `${ chalk . green ( client ) } client connecting to ${ chalk . yellow ( url ) } ` )
51
+ const port2serverMap = {
52
+ 5000 : 'FastAPI' ,
53
+ 5001 : 'Flask' ,
54
+ 5002 : 'Pyramid' ,
55
+ 5003 : 'Tornado' ,
56
+ 5004 : 'Flask-Socket.IO' ,
57
+ 5005 : 'Python-Socket.IO' ,
58
+ 5006 : 'Eventlet' ,
59
+ 5007 : 'FastAPI WebSocket' ,
60
+ 5008 : 'Tornado WebSocket' ,
61
+ 5009 : 'WebSockets'
62
+ }
63
+
64
+ export function logConnecting ( client , url , serverByPort = true ) {
65
+ let message = ''
66
+ const clientConnectingTo = `${ chalk . green ( client ) } client connecting to`
67
+ if ( serverByPort ) {
68
+ const port = url . match ( / : ( \d + ) / ) [ 1 ]
69
+ const server = port2serverMap [ port ]
70
+ const serverOn = `${ chalk . cyan ( server ) } on`
71
+ message = `${ clientConnectingTo } ${ serverOn } ${ chalk . yellow ( url ) } `
72
+ } else {
73
+ message = `${ clientConnectingTo } ${ chalk . yellow ( url ) } `
74
+ }
75
+
76
+ log ( message )
53
77
}
54
78
55
79
export function logIterations ( iters ) {
56
- log ( `Running test with ${ chalk . cyan ( iters . toLocaleString ( ) ) } iterations` )
80
+ log ( `Running test with ${ chalk . red ( iters . toLocaleString ( ) ) } iterations` )
57
81
}
58
82
59
83
export function logError ( err ) {
You can’t perform that action at this time.
0 commit comments