filecoin-project / specs-actors

DEPRECATED Specification of builtin actors, in the form of executable code.
Other
86 stars 102 forks source link

Feat/alter log level #1538

Closed koalacxr closed 2 years ago

koalacxr commented 2 years ago

1、add actor log level

2、Lotus can set log level for an actor. as follows:

` import ( exported0 "github.com/filecoin-project/specs-actors/actors/builtin/exported" exported2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/exported" exported3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/exported" exported4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/exported" scBuiltin "github.com/filecoin-project/specs-actors/v5/actors/builtin" exported5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/exported" exported6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/exported" scBuiltin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" exported7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/exported" )

func NewActorRegistry() *vm.ActorRegistry { inv := vm.NewActorRegistry()

// TODO: define all these properties on the actors themselves, in specs-actors.

inv.Register(vm.ActorsVersionPredicate(actors.Version0), exported0.BuiltinActors()...)
inv.Register(vm.ActorsVersionPredicate(actors.Version2), exported2.BuiltinActors()...)
inv.Register(vm.ActorsVersionPredicate(actors.Version3), exported3.BuiltinActors()...)
inv.Register(vm.ActorsVersionPredicate(actors.Version4), exported4.BuiltinActors()...)
inv.Register(vm.ActorsVersionPredicate(actors.Version5), exported5.BuiltinActors()...)
inv.Register(vm.ActorsVersionPredicate(actors.Version6), exported6.BuiltinActors()...)
inv.Register(vm.ActorsVersionPredicate(actors.Version6), exported7.BuiltinActors()...)

    // add actor log level
for _, actor := range exported7.BuiltinActors() {
    if actor.Code() == scBuiltin.StorageMinerActorCodeID {
        scBuiltin7.SetActorsLogLevel(rtt.INFO, actor)
    }
}

return inv

} `

koalacxr commented 2 years ago

@ZenGround0 @iand @nonsense @BigLep @ingar This merge about come up with a design for logging at different levels based on actor address

arajasek commented 2 years ago

I'm very sympathetic to the usecase here, but I don't think this quite works -- we do want individual actors to be able to distinguish between an INFO and an ERROR, so there needs to be a second "dimension" to this.

The simplest option would be to allow logging to mute certain actors -- that way they can continue to log at their desired importance level, but the consumer (like Lotus) could just skip muted logs.

koalacxr commented 2 years ago

I agree with

koalacxr commented 2 years ago

close