Browse Source

Add logging.colour settings option

master
Starbeamrainbowlabs 1 year ago
parent
commit
2a9de80848
4 changed files with 15 additions and 3 deletions
  1. +2
    -2
      server/Helpers/Ansi.mjs
  2. +4
    -0
      server/bootstrap/container.mjs
  3. +5
    -1
      server/settings.default.toml
  4. +4
    -0
      ttn-listener.service

+ 2
- 2
server/Helpers/Ansi.mjs View File

@ -12,13 +12,13 @@
* - Initial public release
*/
class Ansi {
constructor() {
constructor(enabled = true) {
/**
* Whether we should *actually* emit ANSI escape codes or not.
* Useful when we want to output to a log file, for example
* @type {Boolean}
*/
this.enabled = true;
this.enabled = enabled;
this.escape_codes();
}


+ 4
- 0
server/bootstrap/container.mjs View File

@ -34,6 +34,10 @@ export default async function setup() {
DataProcessor: a.asClass(DataProcessor)
});
// Enable / disable colourising the output
c.cradle.ansi.enabled = settings.logging.colour;
c.cradle.ansi.escape_codes();
let repo_filenames = await fs.readdir(path.join(root_dir, "./Repos.SQLite"));
for(let repo_filename of repo_filenames) {


+ 5
- 1
server/settings.default.toml View File

@ -54,9 +54,13 @@ devices = [
[logging]
# The format the date displayed when logging things should take.
# Allowed values: relative (e.g like when a Linux machine boots), absolute (e.g. like Nginx server logs)
# Allowed values: relative (e.g like when a Linux machine boots), absolute (e.g. like Nginx server logs), none (omits it entirely))
date_display_mode = "relative"
# Whether we should be verbose and log a bunch of stuff to the console.
# Disabled by default, but useful for debugging.
verbose = false
# Whether we should output ANSI escape sequences to colourise the output or not.
# Defaults to true, but you should turn it off if you're using syslog.
colour = true

+ 4
- 0
ttn-listener.service View File

@ -17,5 +17,9 @@ ExecStart=/home/sbrl/Msc-Summer-Project/build server-ttn
Restart=always
# Other Restart options: or always, on-abort, etc
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=ttn-listener
[Install]
WantedBy=multi-user.target

Loading…
Cancel
Save