Closed LLeon360 closed 3 months ago
Currently the dev task for deno task dev
just uses --allow-write=. I'm not sure what the best way is to put the log directory from config into here or if I should just not use a config.
Currently the dev task for
deno task dev
just uses --allow-write=. I'm not sure what the best way is to put the log directory from config into here or if I should just not use a config.
It'd probably be smart to use a config, you can use --allow-write=./log/
if you'd like to specify a directory
I have a config file called config.json that looks like:
{
"logging" : {
"logDir" : "logs/",
"infoLog" : "info_log.log",
"errorLog" : "error_log.log"
}
}
just not sure what the best way is to get logDir and put it into the allow-write.
I have a config file called config.json that looks like: just not sure what the best way is to get logDir and put it into the allow-write.
JSON does not have a way to fetch values from other JSON files without writing external code (it would be quite the security vulnerability otherwise!). It also can't self reference, so you'll have to manually write --allow-write=./logs/
That being said, deno.json doesn't seem to be upset if you add your own fields that are not their own, so you can just merge your config.json into deno.json (although this is a personal decision of whether to have a change point in multiple files or just one vs separating deno and your normal config)
Added a config to designate where logs go and add logging to log some information and timestamps for successful requests as well as errors.