mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
Log messages for streaming debug
This commit is contained in:
@@ -142,6 +142,7 @@ function server(
|
||||
app.head("/stream/track/:id", async (req, res) => {
|
||||
const id = req.params["id"]!;
|
||||
const accessToken = req.headers[BONOB_ACCESS_TOKEN_HEADER] as string;
|
||||
logger.info(`Stream HEAD requested for ${id}, accessToken=${accessToken}`)
|
||||
const authToken = accessTokens.authTokenFor(accessToken);
|
||||
if (!authToken) {
|
||||
return res.status(401).send();
|
||||
@@ -165,6 +166,7 @@ function server(
|
||||
app.get("/stream/track/:id", async (req, res) => {
|
||||
const id = req.params["id"]!;
|
||||
const accessToken = req.headers[BONOB_ACCESS_TOKEN_HEADER] as string;
|
||||
logger.info(`Stream requested for ${id}, accessToken=${accessToken}`)
|
||||
const authToken = accessTokens.authTokenFor(accessToken);
|
||||
if (!authToken) {
|
||||
return res.status(401).send();
|
||||
@@ -182,6 +184,7 @@ function server(
|
||||
it.stream({ trackId: id, range: req.headers["range"] || undefined })
|
||||
)
|
||||
.then((trackStream) => {
|
||||
logger.info(`Streaming ${id}, status=${trackStream.status}, headers=(${JSON.stringify(trackStream.headers)})`)
|
||||
res.status(trackStream.status);
|
||||
Object.entries(trackStream.headers)
|
||||
.filter(([_, v]) => v !== undefined)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
global.console = {
|
||||
// log: console.log,
|
||||
log: jest.fn(), // console.log are ignored in tests
|
||||
log: console.log,
|
||||
//log: jest.fn(), // console.log are ignored in tests
|
||||
|
||||
// Keep native behaviour for other methods, use those to print out things in your own tests, not `console.log`
|
||||
error: console.error,
|
||||
|
||||
Reference in New Issue
Block a user