Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fileTransport #1189

Merged
merged 10 commits into from
Jan 25, 2023
Merged

feat: add fileTransport #1189

merged 10 commits into from
Jan 25, 2023

Conversation

TarikGul
Copy link
Member

@TarikGul TarikGul commented Jan 19, 2023

closes: #1188

Summary

Give users the ability to write logs to a file for better debugging etc.

Env Vars

  • SAS_LOG_WRITE: Whether or not to write logs to a log file. Default is set to false. Accepts a boolean value. The log files will be written as logs.log. NOTE: Tt will only log what is available depending on what SAS_LOG_LEVEL is set to.
  • SAS_LOG_WRITE_PATH: Specifies the path to write the log files. Default will be where the package is installed.
  • SAS_LOG_WRITE_MAX_FILE_SIZE: Specifies in bytes what the max file size for the written log files should be. Default is 5242880 (5MB).
  • SAS_LOG_WRITE_MAX_FILES: Specifies how many files can be written. Default is 5.

@TarikGul TarikGul requested a review from a team as a code owner January 19, 2023 22:34
marshacb
marshacb approved these changes Jan 23, 2023
Copy link
Collaborator

@marshacb marshacb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good to me!

@TarikGul TarikGul changed the title [WIP] feat: add fileTransport feat: add fileTransport Jan 24, 2023
@TarikGul TarikGul requested a review from Imod7 January 24, 2023 14:17
@TarikGul TarikGul self-assigned this Jan 24, 2023
Copy link
Contributor

@Imod7 Imod7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

I noticed the following on how the logs are saved in the file(s) :

  • Whenever the max size of file and max file(s) are reached, the logs are re-written.
  • However whenever Sidecar is started again, the logs are appended in the file(s) until the max size file and max files are reached again.

If we would like the log files to be re-written also every time Sidecar starts/runs then we only need to add this line :
options: { flags: 'w' }
when we return the transports.File.

@TarikGul TarikGul merged commit 9c2effb into master Jan 25, 2023
@TarikGul TarikGul deleted the tarik-file-transport branch January 25, 2023 14:54
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Add a FileTransport for local logging options to help debug external user issues
3 participants