Closed Stephanevg closed 5 years ago
Tu as regardé du côté de arneaud petit-jean il a un module de log qui intègre le log rotate si je me souviens bien 😉
@LaurentLienhard do you have a link to the project?
In my opinion forcing an external module is not the right way to go. I would either write an own solution (but that may be unnecessary and would not fit the scope of this project), or (prefferably) give the enduser the possibilty to log with an existing module.
So standardwise you would have logging disabled in the configfile mentioned in #153 and you could opt in for the logging functionality and you would then have to download the external logging module to have it work.
The logging module mentioned by @LaurentLienhard looks very promising in my opinion. Defenitly worth considering to use it.
PoshBot has actually quite an interesting logging functionality: See here --> https://github.com/poshbotio/PoshBot/blob/master/PoshBot/Classes/Logger.ps1 and here --> https://github.com/poshbotio/PoshBot/blob/master/PoshBot/Classes/BaseLogger.ps1
As mentionned in https://github.com/Stephanevg/PSHTML/issues/153 I think that the PSFramework is to large for what we want to do.
Taking the example of Poshbot, EZLog and my personal experience, I think we will be better of if we develop a custom solution, based on classes using the strategy pattern.
Ok, I have almost a first version. In the conffig file, I let the user change the path of log location. I am just unsure of where it should be written 'by default'.
{
"version":"1.0.0",
"Configuration": {
"Verbosity": "Normal"
},
"Logging": {
"Path": "default,
"MaxFiles": 200,
"MaxTotalSize": "5MB"
},
"Assets": {
"Path": "Default"
}
}
As seen above, if path:default
it would write the log to a default location.
I need this path to be:
1) an environment variable which is available on Windows & linux
2) as a default name for the file, I choose pshtml.log. (please share if you think you have a better idea). In a later step, I'll add log rotation, and archiving of the logs.
To answer above: Default path on Windows: $Env:ProgramData\Pshtml\pshtml.log defaut path on Linux: /tmp/html/html.log (/var/log/ need root access).
feature has been implemented in version 0.7.2 via this PR https://github.com/Stephanevg/PSHTML/pull/183 Closing this ticket. thanks for the participation guys!! 👍
-- Edit: implemented in version 0.7.2 via this PR https://github.com/Stephanevg/PSHTML/pull/183
I would like to discuss the following:
How can we integrate some extension logging support?
Globally, I think it should support at (least) these features 1) Should be able to log to file 2) AutoRotate 3) Should work on Windows and Linux 4) Each PSHTML run should be logged in the background 5) Should be easy to specifiy the logging path
I would like to discuss the following questions:
Is there an existing module that we 'perhaps' have a dependency on? If not, would it make sense to develop our own solution?