Commit graph

11 commits

Author SHA1 Message Date
Lucas Bajolet
805015c360 log: simplify the logOutput function
The logOutput function had a bunch of nested checks in the code for the
function, as well as one ineffasign pointed out by golangci-lint.

This commit changes how special cases are processed, and changes a bit
how log redirection to a file is handled.
Prior to this commit, only when PACKER_LOG and PACKER_LOG_FILE are set
does Packer redirect logs to the specified path, which is a bit
superfluous as setting PACKER_LOG_FILE should be enough on its own to
redirect logs and enable verbose logs.

Now, when neither is set, no logOutput is set, if PACKER_LOG_FILE is set
(regardless of PACKER_LOG), we redirect to the specified file, and
finally if PACKER_LOG is set, we redirect to stderr.
2024-07-18 10:51:17 -04:00
hashicorp-copywrite[bot]
19055df3ec
[COMPLIANCE] License changes (#12568)
* Updating the license from MPL to Business Source License

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at https://hashi.co/license-faq, and details of the license at www.hashicorp.com/bsl.

* Update copyright file headers to BUSL-1.1

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-10 15:53:29 -07:00
hashicorp-copywrite[bot]
b7df3ca36f
[COMPLIANCE] Add Copyright and License Headers (#12254)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-03-02 15:37:05 -05:00
Megan Marsh
60cf4f6014 log errors in scanner and manually close logging pipe if we hit an error in the scanner 2019-11-11 09:20:39 -08:00
Megan Marsh
88530a7944 if someone logs a line longer than 65*1024 bytes before it contains a newline, the default ScanLines func in bufio.Scanner can't handle it. Copy that func and add a conditional to clear buffer and continue scanning in this situation. 2019-11-08 12:34:36 -08:00
Megan Marsh
9912e569e1 deduplicate loglines that stream both to ui ERROR call and to streaming logs when PACKER_LOG=1 2019-07-25 16:33:02 -07:00
Jake Champlin
849914b756 Use Sprint() instead of Sprintf() in log dedupe
Uses `fmt.Sprint()` instead of `fmt.Sprintf()` for log deduplication.

Fixes: #6796
2018-10-09 22:43:54 -04:00
Megan Marsh
941d2fcca6 deduplicate logs that stream to terminal 2018-08-21 15:24:17 -07:00
Sander van Harmelen
1fbadb4de9 Fix debug logging
The change done in #3964 causes the if statement to check if debug logging should be enabled to always pass.
2016-10-07 21:10:20 +02:00
Bartosz "mastier" Woronicz
dac049d4f3 disable log also for PACKER_LOG=0 2016-10-05 16:43:12 +02:00
Mitchell Hashimoto
8054e66db6 command: move more to this package, remove old packages 2014-10-27 20:31:02 -07:00