diff --git a/README.md b/README.md index 8a173851..04fe7c87 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,10 @@ - [Environment Variables](#environment-variables-1) - [Mountable Volumes](#mountable-volumes-1) - [Docker health check](#docker-health-check) + - [Logging](#logging) + - [Trace (7)](#trace-7) + - [Verbose (6)](#verbose-6) + - [Debug (5)](#debug-5) - [Traefik Integration](#traefik-integration) - [Labels](#labels) - [Dynamic.yml](#dynamicyml) @@ -155,6 +159,7 @@ For the [environment variables](#environment-variables), you may specify these i | `TZ` | `Etc/UTC` | Timezone for error / log reporting | | `WEB_IP` | `0.0.0.0` | IP to use for webserver | | `WEB_PORT` | `4124` | Port to use for webserver | +| `WEB_FOLDER` | `www` | Internal container folder to keep TVApp2 web files in.

⚠️ This should not be used unless you know what you're doing | | `WEB_ENCODING` | `deflate, br` | Defines the HTTP `Accept-Encoding` request and response header. This value specifies what content encoding the sender can understand

Gzip compression can be enabled by specifying `'gzip, deflate, br'` | | `WEB_PROXY_HEADER` | `x-forwarded-for` | Defines the header to look for when finding a client's IP address. Used to get a client's IP when behind a reverse proxy or Cloudflare | | `URL_REPO` | `https://git.binaryninja.net/BinaryNinja/` | Determines where the data files will be downloaded from. Do not change this or you will be unable to get M3U and EPG data. | @@ -165,7 +170,7 @@ For the [environment variables](#environment-variables), you may specify these i | `STREAM_QUALITY` | `hd` | Stream quality
Can be either `hd` or `sd` | | `DIR_BUILD` | `/usr/src/app` | Path inside container where TVApp2 will be built.

⚠️ This should not be used unless you know what you're doing | | `DIR_RUN` | `/usr/bin/app` | Path inside container where TVApp2 will be placed after it is built

⚠️ This should not be used unless you know what you're doing | -| `LOG_LEVEL` | `4` | Level of logging to display in console
`6` Trace & below
`5` Debug & below
`4` Info & below
`3` Notice & below
`2` Warn & below
`1` Error only | +| `LOG_LEVEL` | `4` | Level of logging to display in console
`7` Trace & below
`6` Verbose & below
`5` Debug & below
`4` Info & below
`3` Notice & below
`2` Warn & below
`1` Error only |

@@ -1205,6 +1210,7 @@ This docker container contains the following env variables: | `TZ` | `Etc/UTC` | Timezone for error / log reporting | | `WEB_IP` | `0.0.0.0` | IP to use for webserver | | `WEB_PORT` | `4124` | Port to use for webserver | +| `WEB_FOLDER` | `www` | Internal container folder to keep TVApp2 web files in.

⚠️ This should not be used unless you know what you're doing | | `WEB_ENCODING` | `deflate, br` | Defines the HTTP `Accept-Encoding` request and response header. This value specifies what content encoding the sender can understand

Gzip compression can be enabled by specifying `'gzip, deflate, br'` | | `WEB_PROXY_HEADER` | `x-forwarded-for` | Defines the header to look for when finding a client's IP address. Used to get a client's IP when behind a reverse proxy or Cloudflare | | `URL_REPO` | `https://git.binaryninja.net/BinaryNinja/` | Determines where the data files will be downloaded from. Do not change this or you will be unable to get M3U and EPG data. | @@ -1215,7 +1221,7 @@ This docker container contains the following env variables: | `STREAM_QUALITY` | `hd` | Stream quality
Can be either `hd` or `sd` | | `DIR_BUILD` | `/usr/src/app` | Path inside container where TVApp2 will be built.

⚠️ This should not be used unless you know what you're doing | | `DIR_RUN` | `/usr/bin/app` | Path inside container where TVApp2 will be placed after it is built

⚠️ This should not be used unless you know what you're doing | -| `LOG_LEVEL` | `4` | Level of logging to display in console
`6` Trace & below
`5` Debug & below
`4` Info & below
`3` Notice & below
`2` Warn & below
`1` Error only | +| `LOG_LEVEL` | `4` | Level of logging to display in console
`7` Trace & below
`6` Verbose & below
`5` Debug & below
`4` Info & below
`3` Notice & below
`2` Warn & below
`1` Error only |

@@ -1276,6 +1282,92 @@ health check:
+### Logging + +This docker container includes numerous log levels you can switch between in order to see exactly what the docker container is doing during operations. + +Out-of-box, the default value is set to `4`: + +```yml + environment: + - TZ=Etc/UTC + - LOG_LEVEL=4 +``` + +
+ +The default level of `info (4)` will give you all messages related to running your container. It should be enough for everyday users. This log level includes: + +- All informative messages +- All errors +- All warnings +- All notices + +
+ +However, this container supports three levels with high verbosity: +- **Trace**: 7 +- **Verbose**: 6 +- **Debug**: 5 + +
+ +#### Trace (7) + +This **LOG_LEVEL** will output anything that you can see with **debug** `LOG_LEVEL=5`; but with the addition that each log output to your console will show a complete traceback of how the log was triggered. + +
+ +> [!NOTE] +> Users should be cautioned that using `LOG_LEVEL=7` will generate a large amount of logs to your console, especially when you initiate watching an IPTV channel. + +
+ +```shell +Trace: tvapp2 → .gzp [requests] ⚙️ Requesting to create compressed gzip from uncompressed XML data /usr/bin/app/www/xmltv.xml /usr/bin/app/www/xmltv.xml.gz + at Log.debug (file:///usr/bin/app/index.js:182:21) + at getGzip (file:///usr/bin/app/index.js:658:13) + at initialize (file:///usr/bin/app/index.js:1840:15) + at process.processTicksAndRejections (node:internal/process/task_queues:105:5) + at async file:///usr/bin/app/index.js:2288:5 +``` + +
+ +#### Verbose (6) + +This **LOG_LEVEL** will output anything that you can see with **debug** `LOG_LEVEL=5`; as well as even deeper logs; such as every environment variable your TVApp2 container has assigned. You should not need to use this log level unless you are troubleshooting an issue or if instructed to do so by the developers. + +```shell +tvapp2 → .env [assigner] 📣 npm_config_user_agent npm/10.9.1 node/v22.13.1 linux x64 workspaces/false +tvapp2 → .env [assigner] 📣 HOSTNAME tvapp2 +tvapp2 → .env [assigner] 📣 SHLVL 4 +tvapp2 → .env [assigner] 📣 HOME /root +tvapp2 → .env [assigner] 📣 OLDPWD /run/s6/legacy-services/tvapp2 +``` + +
+ +#### Debug (5) + +This **LOG_LEVEL** will output many of the steps that this container takes to create new XML guide and M3U playlist files. It will also output the environment variables you have set associated with the docker image itself. + +
+ +```shell +tvapp2 → .net [assigner] ⚙️ IP_CONTAINER 172.18.0.7 +tvapp2 → .net [assigner] ⚙️ IP_GATEWAY 172.18.0.1 +tvapp2 → .env [assigner] ⚙️ RELEASE stable +tvapp2 → .env [assigner] ⚙️ WEB_IP 0.0.0.0 +tvapp2 → .env [assigner] ⚙️ WEB_PORT 4124 +tvapp2 → .env [assigner] ⚙️ WEB_FOLDER www +tvapp2 → file [requests] ⚙️ Requesting to download external file https://git.binaryninja.net/binaryninja//XMLTV-EPG/raw/branch/main/xmltv.1.xml /usr/bin/app/www/xmltv.xml +``` + +
+ + + ---
diff --git a/tvapp2/index.js b/tvapp2/index.js index 2146cc01..a7371821 100755 --- a/tvapp2/index.js +++ b/tvapp2/index.js @@ -96,7 +96,7 @@ const extM3U = `${ envUrlRepo }/tvapp2-externals/raw/branch/main/formatted.dat`; let urls = []; const gCookies = {}; -const USERAGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'; +const USERAGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0'; /* Web url shortcuts @@ -138,7 +138,7 @@ const envIpContainer = fs.existsSync( fileIpContainer ) ? fs.readFileSync( fileI not be the same as the rgb value. It's best to just stick to Chalk's default colors. Various levels of logs with the following usage: - Log.trace(`This is trace`) + Log.verbose(`This is verbose`) Log.debug(`This is debug`) Log.info(`This is info`) Log.ok(`This is ok`) @@ -168,12 +168,6 @@ class Log return chalk.gray( `[${ now.toLocaleTimeString() }]` ); } - static trace( ...msg ) - { - if ( LOG_LEVEL >= 7 ) - console.trace( chalk.white.bgMagenta.bold( ` ${ name } ` ), chalk.white( `→` ), this.now(), chalk.magentaBright( msg.join( ' ' ) ) ); - } - static verbose( ...msg ) { if ( LOG_LEVEL >= 6 ) @@ -182,7 +176,9 @@ class Log static debug( ...msg ) { - if ( LOG_LEVEL >= 5 ) + if ( LOG_LEVEL >= 7 ) + console.trace( chalk.white.bgMagenta.bold( ` ${ name } ` ), chalk.white( `→` ), this.now(), chalk.magentaBright( msg.join( ' ' ) ) ); + else if ( LOG_LEVEL >= 5 ) console.debug( chalk.white.bgGray.bold( ` ${ name } ` ), chalk.white( `→` ), this.now(), chalk.gray( msg.join( ' ' ) ) ); }