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) => {
|
app.head("/stream/track/:id", async (req, res) => {
|
||||||
const id = req.params["id"]!;
|
const id = req.params["id"]!;
|
||||||
const accessToken = req.headers[BONOB_ACCESS_TOKEN_HEADER] as string;
|
const accessToken = req.headers[BONOB_ACCESS_TOKEN_HEADER] as string;
|
||||||
|
logger.info(`Stream HEAD requested for ${id}, accessToken=${accessToken}`)
|
||||||
const authToken = accessTokens.authTokenFor(accessToken);
|
const authToken = accessTokens.authTokenFor(accessToken);
|
||||||
if (!authToken) {
|
if (!authToken) {
|
||||||
return res.status(401).send();
|
return res.status(401).send();
|
||||||
@@ -165,6 +166,7 @@ function server(
|
|||||||
app.get("/stream/track/:id", async (req, res) => {
|
app.get("/stream/track/:id", async (req, res) => {
|
||||||
const id = req.params["id"]!;
|
const id = req.params["id"]!;
|
||||||
const accessToken = req.headers[BONOB_ACCESS_TOKEN_HEADER] as string;
|
const accessToken = req.headers[BONOB_ACCESS_TOKEN_HEADER] as string;
|
||||||
|
logger.info(`Stream requested for ${id}, accessToken=${accessToken}`)
|
||||||
const authToken = accessTokens.authTokenFor(accessToken);
|
const authToken = accessTokens.authTokenFor(accessToken);
|
||||||
if (!authToken) {
|
if (!authToken) {
|
||||||
return res.status(401).send();
|
return res.status(401).send();
|
||||||
@@ -182,6 +184,7 @@ function server(
|
|||||||
it.stream({ trackId: id, range: req.headers["range"] || undefined })
|
it.stream({ trackId: id, range: req.headers["range"] || undefined })
|
||||||
)
|
)
|
||||||
.then((trackStream) => {
|
.then((trackStream) => {
|
||||||
|
logger.info(`Streaming ${id}, status=${trackStream.status}, headers=(${JSON.stringify(trackStream.headers)})`)
|
||||||
res.status(trackStream.status);
|
res.status(trackStream.status);
|
||||||
Object.entries(trackStream.headers)
|
Object.entries(trackStream.headers)
|
||||||
.filter(([_, v]) => v !== undefined)
|
.filter(([_, v]) => v !== undefined)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
global.console = {
|
global.console = {
|
||||||
// log: console.log,
|
log: console.log,
|
||||||
log: jest.fn(), // console.log are ignored in tests
|
//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`
|
// Keep native behaviour for other methods, use those to print out things in your own tests, not `console.log`
|
||||||
error: console.error,
|
error: console.error,
|
||||||
|
|||||||
Reference in New Issue
Block a user