@@ -20,17 +20,27 @@ import cats.mtl.{LiftKind, Local}
2020import  cats .syntax .flatMap .* 
2121import  cats .{~> , Monad , Show }
2222
23+ /** 
24+  * A logger with [[cats.mtl.Local `Local` ]] semantics. 
25+  * 
26+  * @see  
27+  *   [[withAddedContext ]] 
28+  */  
2329sealed  trait  LocalLogger [F [_]] extends  SelfAwareLogger [F ] {
2430
2531  /**  
26-    * @return  
27-    *   the given effect modified to have the provided context stored [[cats.mtl.Local locally ]] 
32+    * Modifies the given effect to have the provided context stored [[cats.mtl.Local locally ]]. 
33+    * 
34+    * Context added using this method is available to all loggers created by this logger's 
35+    * [[LocalLoggerFactory parent factory ]]. 
2836   */  
2937  def  withAddedContext [A ](ctx : Map [String , String ])(fa : F [A ]):  F [A ]
3038
3139  /**  
32-    * @return  
33-    *   the given effect modified to have the provided context stored [[cats.mtl.Local locally ]] 
40+    * Modifies the given effect to have the provided context stored [[cats.mtl.Local locally ]]. 
41+    * 
42+    * Context added using this method is available to all loggers created by this logger's 
43+    * [[LocalLoggerFactory parent factory ]]. 
3444   */  
3545  def  withAddedContext [A ](ctx : (String , Show .Shown )* )(fa : F [A ]):  F [A ]
3646
@@ -45,20 +55,24 @@ sealed trait LocalLogger[F[_]] extends SelfAwareLogger[F] {
4555  def  trace (ctx : Map [String , String ])(msg : =>  String ):  F [Unit ]
4656  def  trace (ctx : Map [String , String ], t : Throwable )(msg : =>  String ):  F [Unit ]
4757
48-   @ deprecated(
49-     " use the overload that takes a `LiftKind` and `Monad` instead"  ,
50-     since =  " 2.8.0" 
51-   )
58+   @ deprecated(" use `liftTo` instead"  , since =  " log4cats 2.8.0"  )
5259  override  def  mapK [G [_]](fk : F  ~>  G ):  SelfAwareLogger [G ] =  super .mapK(fk)
5360
5461  /**  Lifts this logger's context from `F` to `G`. */  
5562  def  liftTo [G [_]](implicit  lift : LiftKind [F , G ], G :  Monad [G ]):  LocalLogger [G ]
5663
5764  override  def  withModifiedString (f : String  =>  String ):  LocalLogger [F ]
5865
66+   /**  
67+    * A view of this logger as a [[`StructuredLogger` ]], to support gradual migration away from 
68+    * `StructuredLogger`. Log context added using this `LocalLogger` or its 
69+    * [[LocalLoggerFactory parent factory ]] will be included in log messages created by 
70+    * `StructuredLogger`s returned by this method, regardless of the scope in which this method was 
71+    * called. 
72+    */  
5973  @ deprecated(
6074    " `StructuredLogger` is cumbersome and lacks `cats.mtl.Local` semantics"  ,
61-     since =  " 2.8.0" 
75+     since =  " log4cats  2.8.0" 
6276  )
6377  def  asStructuredLogger :  SelfAwareStructuredLogger [F ]
6478}
@@ -86,10 +100,7 @@ object LocalLogger {
86100    def  isDebugEnabled :  F [Boolean ] =  underlying.isDebugEnabled
87101    def  isTraceEnabled :  F [Boolean ] =  underlying.isTraceEnabled
88102
89-     @ deprecated(
90-       " use the overload that takes a `LiftKind` and `Monad` instead"  ,
91-       since =  " 2.8.0" 
92-     )
103+     @ deprecated(" use `liftTo` instead"  , since =  " log4cats 2.8.0"  )
93104    override  def  mapK [G [_]](fk : F  ~>  G ):  SelfAwareStructuredLogger [G ] = 
94105      super .mapK(fk)
95106    def  liftTo [G [_]](implicit  lift : LiftKind [F , G ], G :  Monad [G ]):  LocalLogger [G ] = 
@@ -99,7 +110,7 @@ object LocalLogger {
99110
100111    @ deprecated(
101112      " `StructuredLogger` is cumbersome and lacks `cats.mtl.Local` semantics"  ,
102-       since =  " 2.8.0" 
113+       since =  " log4cats  2.8.0" 
103114    )
104115    def  asStructuredLogger :  SelfAwareStructuredLogger [F ] =  this 
105116
@@ -229,12 +240,28 @@ object LocalLogger {
229240      )
230241  }
231242
243+   /**  
244+    * This method should only be used when a [[`LoggerFactory` ]] is not available; when possible, 
245+    * create a [[`LocalLoggerFactory` ]] and use that to create `LocalLogger`s. 
246+    * 
247+    * @return  
248+    *   a [[cats.mtl.Local local ]] logger backed by the given [[`LocalLogContext` ]] and 
249+    *   [[`LoggerFactory` ]] 
250+    */  
232251  def  apply [F [_]:  Monad ](
233252      localLogContext : LocalLogContext [F ],
234253      underlying : SelfAwareStructuredLogger [F ]
235254  ):  LocalLogger [F ] = 
236255    new  Impl (localLogContext, underlying)
237256
257+   /**  
258+    * This method should only be used when a [[`LoggerFactory` ]] is not available; when possible, 
259+    * create a [[`LocalLoggerFactory` ]] and use that to create `LocalLogger`s. 
260+    * 
261+    * @return  
262+    *   a local logger backed by the given [[`SelfAwareStructuredLogger` ]] and implicit 
263+    *   [[cats.mtl.Local `Local` ]] 
264+    */  
238265  def  fromLocal [F [_]:  Monad ](
239266      underlying : SelfAwareStructuredLogger [F ]
240267  )(implicit  localCtx : Local [F , Map [String , String ]]):  LocalLogger [F ] = 
0 commit comments