@@ -13,6 +13,7 @@ limitations under the License.
1313
1414import { Temporal } from "@js-temporal/polyfill" ;
1515import DaprClient from "../../implementation/Client/DaprClient" ;
16+ import { Logger } from "../../logger/Logger" ;
1617import ActorId from "../ActorId" ;
1718import ActorClient from "../client/ActorClient/ActorClient" ;
1819import ActorStateManager from "./ActorStateManager" ;
@@ -42,6 +43,10 @@ export default abstract class AbstractActor {
4243 private readonly actorClient : ActorClient ;
4344 private readonly daprStateProvider : StateProvider ;
4445 private readonly actorType : any ; // set at constructor level
46+ private readonly logger : Logger ;
47+
48+ private readonly LOG_COMPONENT : string = "Actors" ;
49+ private readonly LOG_AREA : string = "AbstractActor" ;
4550
4651 /**
4752 * Instantiates a new Actor
@@ -52,7 +57,7 @@ export default abstract class AbstractActor {
5257 constructor ( daprClient : DaprClient , id : ActorId ) {
5358 this . daprClient = daprClient ;
5459 this . actorClient = new ActorClient ( daprClient . getDaprHost ( ) , daprClient . getDaprPort ( ) , daprClient . getCommunicationProtocol ( ) , daprClient . getOptions ( ) ) ;
55-
60+ this . logger = new Logger ( daprClient . getOptions ( ) . loggerOptions )
5661 this . id = id ;
5762
5863 this . stateManager = new ActorStateManager ( this ) ;
@@ -201,7 +206,7 @@ export default abstract class AbstractActor {
201206 }
202207
203208 async receiveReminder ( _data : string ) : Promise < void > {
204- console . warn ( JSON . stringify ( {
209+ this . logger . warn ( this . LOG_COMPONENT , this . LOG_AREA , JSON . stringify ( {
205210 error : "ACTOR_METHOD_NOT_IMPLEMENTED" ,
206211 errorMsg : `A reminder was created for the actor with id: ${ this . id } but the method 'receiveReminder' was not implemented` ,
207212 } ) ) ;
0 commit comments