Skip to content

verbose Flag Prints to stderr, not stdout #119

@jdnordy

Description

@jdnordy

Bug:

When running geoipudate -v, I noticed that it prints to stderr instead of stdout. I ran into this issue when trying to print output to a log file.

Example 1:
geoipupdate -v 1>/var/www/test.txt

terminal:

Using config file /usr/local/etc/GeoIP.conf
Using database directory {DATABASE_DIR}
Performing get filename request to https://updates.maxmind.com/app/update_getfilename?product_id=GeoLite2-City
Acquired lock file lock ({FILE_PATH}/.geoipupdate.lock)
Calculated MD5 sum for {FILE_PATH}/GeoLite2-City.mmdb: d90975ccfa5460d7ee2b2a9a4ebd93ae
Performing update request to https://updates.maxmind.com/geoip/databases/GeoLite2-City/update?db_md5=d90975ccfa5460d7ee2b2a9a4ebd93ae
No new updates available for GeoLite2-City

test.txt:

// empty

Example 2:
geoipupdate -v 2>/var/www/test.txt

terminal:

// empty

test.txt

Using config file /usr/local/etc/GeoIP.conf
Using database directory {DATABASE_DIR}
Performing get filename request to https://updates.maxmind.com/app/update_getfilename?product_id=GeoLite2-City
Acquired lock file lock ({FILE_PATH}/.geoipupdate.lock)
Calculated MD5 sum for {FILE_PATH}/GeoLite2-City.mmdb: d90975ccfa5460d7ee2b2a9a4ebd93ae
Performing update request to https://updates.maxmind.com/geoip/databases/GeoLite2-City/update?db_md5=d90975ccfa5460d7ee2b2a9a4ebd93ae
No new updates available for GeoLite2-City

Possible Solution:

Instead of of using log.Printf() for verbose flag output, use fmt.Printf()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions