Skip to content

Commit 05d42ea

Browse files
committed
cli: --log-level takes precedence over -v
also updated documentation with parameter and environment variable Signed-off-by: Javi Fontan <[email protected]>
1 parent 0867077 commit 05d42ea

File tree

2 files changed

+40
-24
lines changed

2 files changed

+40
-24
lines changed

cmd/gitbase/command/server.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ func NewDatabaseEngine(
108108
func (c *Server) Execute(args []string) error {
109109
if c.Verbose {
110110
logrus.SetLevel(logrus.DebugLevel)
111-
} else {
111+
}
112+
113+
// info is the default log level
114+
if c.LogLevel != "info" {
112115
level, err := logrus.ParseLevel(c.LogLevel)
113116
if err != nil {
114117
return fmt.Errorf("cannot parse log level: %s", err.Error())

docs/using-gitbase/configuration.md

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
| `GITBASE_CONNECTION_TIMEOUT` | timeout in seconds used for client connections on write and reads. No timeout by default. |
1818
| `GITBASE_USER_FILE` | JSON file with user credentials |
1919
| `GITBASE_MAX_UAST_BLOB_SIZE` | Max size of blobs to send to be parsed by bblfsh. Default: 5242880 (5MB) |
20+
| `GITBASE_LOG_LEVEL` | minimum logging level to show, use `fatal` to suppress most messages. Default: `info` |
2021

2122
### Jaeger tracing variables
2223

@@ -67,31 +68,43 @@ stops the query. With GITBASE_SKIP_GIT_ERRORS variable it won't
6768
complain and just skip those rows or repositories.
6869
6970
Help Options:
70-
-h, --help Show this help message
71+
-h, --help Show this help message
7172
7273
[server command options]
73-
-d, --directories= Path where the git repositories are located (standard and siva), multiple directories can be
74-
defined. Accepts globs.
75-
--depth= load repositories looking at less than <depth> nested subdirectories. (default: 1000)
76-
--host= Host where the server is going to listen (default: localhost)
77-
-p, --port= Port where the server is going to listen (default: 3306)
78-
-u, --user= User name used for connection (default: root)
79-
-P, --password= Password used for connection
80-
-U, --user-file= JSON file with credentials list [$GITBASE_USER_FILE]
81-
-t, --timeout= Timeout in seconds used for connections [$GITBASE_CONNECTION_TIMEOUT]
82-
-i, --index= Directory where the gitbase indexes information will be persisted. (default:
83-
/var/lib/gitbase/index) [$GITBASE_INDEX_DIR]
84-
--cache= Object cache size in megabytes (default: 512) [$GITBASE_CACHESIZE_MB]
85-
--parallelism= Maximum number of parallel threads per table. By default, it's the number of CPU cores. 0
86-
means default, 1 means disabled.
87-
--no-squash Disables the table squashing.
88-
--trace Enables jaeger tracing [$GITBASE_TRACE]
89-
-r, --readonly Only allow read queries. This disables creating and deleting indexes as well. Cannot be used
90-
with --user-file. [$GITBASE_READONLY]
91-
--no-git disable the load of git standard repositories.
92-
--no-siva disable the load of siva files.
93-
-v Activates the verbose mode
94-
74+
--db= Database name (default: gitbase)
75+
-d, --directories= Path where the git repositories are located
76+
(standard and siva), multiple directories can
77+
be defined. Accepts globs.
78+
--depth= load repositories looking at less than
79+
<depth> nested subdirectories. (default: 1000)
80+
--host= Host where the server is going to listen
81+
(default: localhost)
82+
-p, --port= Port where the server is going to listen
83+
(default: 3306)
84+
-u, --user= User name used for connection (default: root)
85+
-P, --password= Password used for connection
86+
-U, --user-file= JSON file with credentials list
87+
[$GITBASE_USER_FILE]
88+
-t, --timeout= Timeout in seconds used for connections
89+
[$GITBASE_CONNECTION_TIMEOUT]
90+
-i, --index= Directory where the gitbase indexes
91+
information will be persisted. (default:
92+
/var/lib/gitbase/index) [$GITBASE_INDEX_DIR]
93+
--cache= Object cache size in megabytes (default: 512)
94+
[$GITBASE_CACHESIZE_MB]
95+
--parallelism= Maximum number of parallel threads per table.
96+
By default, it's the number of CPU cores. 0
97+
means default, 1 means disabled.
98+
--no-squash Disables the table squashing.
99+
--trace Enables jaeger tracing [$GITBASE_TRACE]
100+
-r, --readonly Only allow read queries. This disables
101+
creating and deleting indexes as well. Cannot
102+
be used with --user-file. [$GITBASE_READONLY]
103+
--no-git disable the load of git standard repositories.
104+
--no-siva disable the load of siva files.
105+
-v Activates the verbose mode
106+
--log-level=[info|debug|warning|error|fatal] logging level (default: info)
107+
[$GITBASE_LOG_LEVEL]
95108
```
96109
## User credentials
97110

0 commit comments

Comments
 (0)