Commit Graph

43 Commits

Author SHA1 Message Date
Peter Fern 62bd221be1 Print struct keys for struct log fields
Can be useful for debugging, saves a lot of referring to source code
2015-07-05 17:08:19 +10:00
Anton Tiurin e35e0e00b8 [TextFormatter] Speed up. Fprintf is changed to buffer.Write*
As Fprintf is slower than buffer.WriteString, it's replaced
to faster call.

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-06-28 12:36:14 +03:00
Alexander F Rødseth 29d30d9f63 Terminals on Windows may not have colors 2015-05-12 16:31:17 +02:00
Stephen J Day e14471f8f2 Allow configuration of timestamp layout
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-04-06 12:18:40 -07:00
Tiffany Low 3e3e87a165 allow custom time format string in TextFormatter
- fixes examples in README.md that incorrectly state usage of
  RFC3339Nano format instead of RFC3339
2015-03-26 16:15:06 -07:00
Simon Eskildsen 7495181ab1 text_formatter: remove unneeded regexp 2015-03-19 09:59:55 -04:00
Simon Eskildsen bbf1b22f08 Merge pull request #131 from lvillani/debuglevel-gray
Change DebugLevel color to gray
2015-03-09 11:39:16 -04:00
Simon Eskildsen 538395b333 text_formatter: add field to disable sorting 2015-03-09 15:19:51 +00:00
Simon Eskildsen a020ac2471 Merge pull request #143 from henrikhodne/do-not-quote-9
Text formatter: Do not quote 9
2015-03-04 10:45:58 -05:00
Henrik Hodne cd4266df0e text-formatter: do not quote 9 2015-03-04 14:04:50 +00:00
Simon Eskildsen c0f7e35ed2 text_formatter: improve comments 2015-02-25 19:01:02 +00:00
Steeve Lennmark ccaf6983d9 Add option to show full timestamp in TextFormatter
Sometimes elapsed seconds just aren't enough.
2015-02-20 18:43:24 +02:00
Lorenzo Villani 4fbdf5948e Change DebugLevel color to gray 2015-02-20 16:32:47 +01:00
Anton Tiurin d1dfe8db73 [TextFormatter] Preallocate enough memory for keys to speedup.
Benchmarks:
 * BenchmarkSmallTextFormatter: 6140/5943 ~3%
 * BenchmarkLargeTextFormatter: 28050/24789 ~11%

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-02-17 19:08:32 +03:00
Simon Eskildsen 58f778a886 Revert "Merge pull request #100 from crquan/patch-1"
This reverts commit c6a969a0de, reversing
changes made to 3c5b048a9d.
2015-01-15 13:40:48 -05:00
Derek Che dcbe8d66af make sure no leading or trailing spaces
This changed printColored and printKeyValue to print in same way
with prefix space instead of trailing space, to make it easier
to slice out when returning in Format;
The test cases are to make sure msg formartting doesn't include
leading or trailing spaces;

Closes #99

Signed-off-by: Derek Che <drc@yahoo-inc.com>
2015-01-04 00:19:36 -08:00
Derek Che a243bbaa0b share common calling path in printKeyValue
Signed-off-by: Derek Che <drc@yahoo-inc.com>
2015-01-04 00:01:49 -08:00
Derek Che 03377c6168 rename f.appendKeyValue to printKeyValue
printKeyValue is working similar like printColored, not using
any fields of TextFormatter, should be a util func instead of
a method of TextFormatter.

Signed-off-by: Derek Che <drc@yahoo-inc.com>
2015-01-03 23:56:39 -08:00
Simon Eskildsen 51fe59aca1 Merge pull request #92 from rasky/no-extra-quoting
Avoid extra quotes where not strictly necessary.
2014-12-18 10:52:14 -05:00
Giovanni Bajo 15b296befc Avoid using regexp 2014-12-18 15:09:01 +01:00
Simon Eskildsen 7096056d3c Merge pull request #91 from rasky/disable-timestamp
Allow disabling timestamp in non-tty output.
2014-12-15 16:09:30 -05:00
Giovanni Bajo f0a637a834 Document new option 2014-12-15 21:58:26 +01:00
Giovanni Bajo a3ef049df9 Avoid extra quotes where not strictly necessary.
It's not necessary to enclose in quotes every single string value
in log2met format; when using basic words, it's possible to not
quote it (as heroku does for its own logging). This keeps the
logs easier on the human eye.
2014-12-15 20:20:33 +01:00
Giovanni Bajo 3e9d38f80d Allow disabling timestamp in non-tty output.
This is useful if the output is already being piped to a logger
daemon that will prefix the timestamp by itself (eg: on heroku).
2014-12-15 20:02:02 +01:00
Antoine Grondin 2835e150d9 fixes #88 2014-12-09 21:57:50 -05:00
Antoine Grondin acf1c0d583 textformatter: errors should be in quotes like strings are 2014-10-03 11:58:24 -04:00
Antoine Grondin c4cc714937 fix duplication of msg/time/level keys, add benchmarks. 2014-09-16 20:19:42 -04:00
Antoine Grondin d35b1c983e text-formatter: assume that IsTerminal doesn't change during execution 2014-09-16 17:19:03 -04:00
Matt Price e2a44689a6 updated README and added reference 2014-08-13 13:36:59 -04:00
Matt Price af9d545893 can completely disable colors on text formatter 2014-08-13 13:30:25 -04:00
Simon Eskildsen 2c0db7c868 formatter: drop internalFormatter 2014-07-26 22:22:39 -04:00
Simon Eskildsen 40069a98d6 entry: break out time, level and message from data 2014-07-26 21:34:29 -04:00
Aaron L 0d1e231957 Clean up text_formatter code with a byte.Buffer 2014-05-24 07:48:57 -07:00
Simon Eskildsen 13600d2325 text_formatter: move relative time logic from entry 2014-05-03 20:43:55 -04:00
Rob Napier d32bfc962c Add Windows/FreeBSD support 2014-04-23 19:38:56 -04:00
Dan Buch 79b3145302 Switching non-TTY text formatter to use %q instead of '%v'
so that the output becomes l2met compatible yey!
2014-04-20 15:29:03 -04:00
Simon Eskildsen f9af352362 Merge pull request #10 from pushrax/add-forced-colors
Add option to force TextFormatter to use colors
2014-03-16 16:17:15 -07:00
Justin Li 436d68deda Add option to force TextFormatter to use colors 2014-03-15 23:41:05 -04:00
Justin Li c999e7c963 Set color to red for error level output 2014-03-15 23:34:03 -04:00
Simon Eskildsen 0998f68ad5 text_formatter: ensure quoting of strings 2014-03-14 13:32:49 -04:00
Simon Eskildsen 52eb1c0f57 text_formatter: use %v instead 2014-03-14 13:15:01 -04:00
Simon Eskildsen 1000975e52 text_formatter: change to simpler k-v when no tty 2014-03-14 13:01:06 -04:00
Simon Eskildsen 53371e3664 Add features from README 2014-03-10 19:22:08 -04:00