Commit Graph

7 Commits

Author SHA1 Message Date
Kir Kolyshkin f77fb7a3ee init.go, main.go: don't use logs.ConfigureLogging
This function is somewhat strange and I always wanted to remove it,
as it tries to satisfy both init.go and main.go, which have somewhat
different needs.

It is more straightforward and readable to configure logrus directly.

While at it, simplify errors on panic (errors from logrus.ParseLevel
and strconv.Atoi already contain value which they fail to parse, and
panic already contains enough context to figure out what's wrong).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-08-20 10:59:46 -07:00
Kir Kolyshkin 7a0302f0d7 runc init: simplify
runc init is special. For one thing, it needs to do a few things before
main(), so we have func init() that checks if we're init and does that.

What happens next is main() is called, which does some options parsing,
figures out it needs to call initCommand.Action and so it does.

Now, main() is entirely unnecessary -- we can do everything right from
init().

Hopefully the change makes things slightly less complicated.

From a user's perspective, the only change is runc help no longer
lists 'runc init` (which I think it also good).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-27 12:16:09 -07:00
Kir Kolyshkin d38d1f9f79 libcontainer/logs: use int for Config.LogPipeFd
It does not make sense to have a string for a numeric type.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-03-25 18:56:15 -07:00
Georgi Sabev ba3cabf932 Improve nsexec logging
* Simplify logging function
* Logs contain __FUNCTION__:__LINE__
* Bail uses write_log

Co-authored-by: Julia Nedialkova <julianedialkova@hotmail.com>
Co-authored-by: Danail Branekov <danailster@gmail.com>
Signed-off-by: Georgi Sabev <georgethebeatle@gmail.com>
2019-04-22 17:53:52 +03:00
Danail Branekov c486e3c406 Address comments in PR 1861
Refactor configuring logging into a reusable component
so that it can be nicely used in both main() and init process init()

Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com>
Co-authored-by: Giuseppe Capizzi <gcapizzi@pivotal.io>
Co-authored-by: Claudia Beresford <cberesford@pivotal.io>
Signed-off-by: Danail Branekov <danailster@gmail.com>
2019-04-04 14:57:28 +03:00
Marco Vedovati 9a599f62fb Support for logging from children processes
Add support for children processes logging (including nsexec).
A pipe is used to send logs from children to parent in JSON.
The JSON format used is the same used by logrus JSON formatted,
i.e. children process can use standard logrus APIs.

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
2019-04-04 14:53:23 +03:00
Justin Cormack e469cf0be7 runc only works on Linux so remove putative Solaris and unsupported main
Solaris runc equivalent is not open source. The unsupported option does
not build as other code is Linux specific.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-29 16:00:26 +01:00