File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,6 @@ Configuration is available at:
63
63
- *** nix systems** : ~ /.config/nightwatch
64
64
- ** Windows** : %LocalAppData%\Nightwatch
65
65
66
- Client (terminal) configuration is available at ` client.json ` , while the server configuration is stored in ` server .json` .
66
+ Client (terminal) configuration is available at ` client.json ` , while the server configuration is stored in ` rics .json` .
67
67
The Nightwatch client uses the JSON for username, coloring, and more. Check the ` /config ` command for more information.
68
68
The backend chat server uses the config file for the server name, although more is sure to come.
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ async def connect_endpoint(
173
173
}})
174
174
175
175
# Broadcast join
176
+ log .info ("ws" , f"{ client .username } has joined the server." )
176
177
await app .state .broadcast ({"type" : "join" , "data" : {"user" : client .serialize ()}})
177
178
await app .state .broadcast ({"type" : "message" , "data" : {"message" : f"{ client .username } has joined the server." }})
178
179
@@ -184,6 +185,7 @@ async def connect_endpoint(
184
185
await client .send ({"type" : "problem" , "data" : {"message" : "You cannot send a blank message." }})
185
186
continue
186
187
188
+ log .info ("ws" , f"{ client .username } : { message } " )
187
189
await app .state .broadcast ({"type" : "message" , "data" : {"user" : client .serialize (), "message" : message }})
188
190
if client ._callback is not None :
189
191
await client .send ({"type" : "response" })
@@ -202,6 +204,7 @@ async def connect_endpoint(
202
204
client .cleanup ()
203
205
await app .state .broadcast ({"type" : "leave" , "data" : {"user" : client .serialize ()}})
204
206
await app .state .broadcast ({"type" : "message" , "data" : {"message" : f"{ client .username } has left the server." }})
207
+ log .info ("ws" , f"{ client .username } has left the server." )
205
208
206
209
@app .get ("/api/version" )
207
210
async def route_version () -> JSONResponse :
Original file line number Diff line number Diff line change 6
6
import sys
7
7
8
8
import uvicorn
9
+ from nightwatch .logging import log
9
10
10
11
# Launch uvicorn
12
+ host = os .getenv ("HOST" , "127.0.0.1" )
13
+ port = int (os .getenv ("PORT" ) or 8000 )
14
+ log .info ("http" , f"Running on { host } :{ port } !" )
15
+
11
16
uvicorn .run (
12
17
"nightwatch.rics:app" , # Allow debug reloading,
13
- host = os . getenv ( "HOST" , "127.0.0.1" ) ,
14
- port = int ( os . getenv ( "PORT" ) or 8000 ) ,
15
- # log_level = "critical", # Soon! when i have a better idea for logging requests
18
+ host = host ,
19
+ port = port ,
20
+ log_level = "critical" ,
16
21
reload = "--dev" in sys .argv
17
22
)
You can’t perform that action at this time.
0 commit comments