aboutsummaryrefslogtreecommitdiffstats
path: root/FMark
diff options
context:
space:
mode:
authorThunderMikey <mikecyj25@gmail.com>2018-03-23 10:04:03 +0000
committerps-george <george.punter15@imperial.ac.uk>2018-03-23 10:04:03 +0000
commit2ff041b2ff5f3f6a5dca248cf4ed36e1e0b378e0 (patch)
tree79d2b573d6d632c83b997074c3399d60011f4515 /FMark
parent50e82edfcfcd695d08494bc3252d0204270f6d2b (diff)
downloadFMark-2ff041b2ff5f3f6a5dca248cf4ed36e1e0b378e0.tar.gz
FMark-2ff041b2ff5f3f6a5dca248cf4ed36e1e0b378e0.zip
Logger update (#166)
* removing from ParserHelperFuncs * delete local logger in MarkdownGen * replace all local logger with globLog
Diffstat (limited to 'FMark')
-rw-r--r--FMark/src/Common/Lexer/Lexer.fs3
-rw-r--r--FMark/src/Common/Markalc/Expression.fs5
-rw-r--r--FMark/src/Common/Markalc/MarkalcShared.fs1
-rw-r--r--FMark/src/Common/MarkdownGen/MarkdownGen.fs3
-rw-r--r--FMark/src/Common/Parser/Parser.fs2
-rw-r--r--FMark/src/Common/Parser/ParserHelperFuncs.fs6
-rw-r--r--FMark/src/Common/Shared.fs1
7 files changed, 9 insertions, 12 deletions
diff --git a/FMark/src/Common/Lexer/Lexer.fs b/FMark/src/Common/Lexer/Lexer.fs
index a7bd111..7cde51d 100644
--- a/FMark/src/Common/Lexer/Lexer.fs
+++ b/FMark/src/Common/Lexer/Lexer.fs
@@ -3,6 +3,7 @@ module Lexer
open Types
open Shared
open LexerShared
+open Logger
type LexerState =
| Normal
@@ -74,7 +75,7 @@ let nextToken state s =
| RegexMatch (literalString charList) (m, _, s), _ ->
(LITERAL m, s), state
| s, _ ->
- sprintf "Unrecognised character: %A" s |> sharedLog.Warn None
+ sprintf "Unrecognised character: %A" s |> globLog.Warn None
(toString s.[0] |> LITERAL, (sOnwards 1 s)), state
/// Lexes a whole string and returns the result as a Token list
diff --git a/FMark/src/Common/Markalc/Expression.fs b/FMark/src/Common/Markalc/Expression.fs
index 3e35563..51f9653 100644
--- a/FMark/src/Common/Markalc/Expression.fs
+++ b/FMark/src/Common/Markalc/Expression.fs
@@ -3,6 +3,7 @@ module Expression
open MarkalcShared
open Types
+open Logger
(* SUPPORTED OPERATIONS:
BinaryExpressions (in order of precedence):
@@ -34,10 +35,10 @@ let parseExp toks =
| RSBRA :: NUMBER(col) :: COMMA :: NUMBER(row) :: LSBRA :: after
-> ((row,col) |> makeCellReference,after) |> Some
| RSBRA :: NUMBER(row) :: EQUAL :: LITERAL("row") :: COMMA :: NUMBER(col) :: EQUAL :: LITERAL("col") :: LSBRA :: after
- -> sprintf "Row:%A, Col:%A" row col |> logger.Debug None
+ -> sprintf "Row:%A, Col:%A" row col |> globLog.Debug None
((row,col) |> makeCellReference,after) |> Some
| RSBRA :: NUMBER(col) :: EQUAL :: LITERAL("col") :: COMMA :: NUMBER(row) :: EQUAL :: LITERAL("row") :: LSBRA :: after
- -> sprintf "Row:%A, Col:%A" row col |> logger.Debug None
+ -> sprintf "Row:%A, Col:%A" row col |> globLog.Debug None
((row,col) |> makeCellReference,after) |> Some
| _ -> None
let rec (|ExpressionList|_|) = function
diff --git a/FMark/src/Common/Markalc/MarkalcShared.fs b/FMark/src/Common/Markalc/MarkalcShared.fs
index a0f189a..6ffeab8 100644
--- a/FMark/src/Common/Markalc/MarkalcShared.fs
+++ b/FMark/src/Common/Markalc/MarkalcShared.fs
@@ -106,4 +106,3 @@ let simpleLex txt =
let lexY (x,y,z) = x,y|>simpleLex,z
let round (dp:int) (f:float) =
System.Math.Round(f,dp)
-let logger = Logger(LogLevel.INFO) \ No newline at end of file
diff --git a/FMark/src/Common/MarkdownGen/MarkdownGen.fs b/FMark/src/Common/MarkdownGen/MarkdownGen.fs
index 13008ef..3594a48 100644
--- a/FMark/src/Common/MarkdownGen/MarkdownGen.fs
+++ b/FMark/src/Common/MarkdownGen/MarkdownGen.fs
@@ -5,7 +5,6 @@ open Types
open Shared
open Logger
-let logger = Logger(LogLevel.INFO)
// return string surrounded by pat
let surround pat str =
@@ -99,7 +98,7 @@ let rec mdList list =
| _,"" -> ""
| true,_ ->
sprintf "%s%i. %s\n" (makeTabs tab) pCount s
- |> logPassN logger.Debug
+ |> logPassN globLog.Debug
| false,_ ->
sprintf "%s- %s\n" (makeTabs tab) s) |> retFold
| NestedList(list) -> mdList list |> retFold
diff --git a/FMark/src/Common/Parser/Parser.fs b/FMark/src/Common/Parser/Parser.fs
index 507bf73..2e10969 100644
--- a/FMark/src/Common/Parser/Parser.fs
+++ b/FMark/src/Common/Parser/Parser.fs
@@ -16,7 +16,7 @@ let rec parseCode toks =
parseCode toks'
|> Result.map (fun (str, tks) ->
mapTok tok + str, tks )
- | e -> sharedLog.Warn None (sprintf "%A" e)
+ | e -> globLog.Warn None (sprintf "%A" e)
("\\`", xOnwards 1 toks) |> Ok
diff --git a/FMark/src/Common/Parser/ParserHelperFuncs.fs b/FMark/src/Common/Parser/ParserHelperFuncs.fs
index 997af6d..0856a07 100644
--- a/FMark/src/Common/Parser/ParserHelperFuncs.fs
+++ b/FMark/src/Common/Parser/ParserHelperFuncs.fs
@@ -3,8 +3,6 @@ open Types
open Shared
open Logger
-let logger = Logger(LogLevel.INFO)
-
let SPACE = " "
let NOSTRING = ""
@@ -386,12 +384,12 @@ let parseInLineElements2 refLst toks =
match refs with
| [] ->
let msg = sprintf "[Reference: %A not found!]" refId
- msg |> logger.Info (Some 200) |> ignore
+ msg |> globLog.Info (Some 200) |> ignore
msg |> Error
| [exactlyOne] -> exactlyOne |> Ok
| moreThanOne ->
let msg = sprintf "Reference: %A occurred more than once in reference list, take the first one." refId
- msg |> logger.Info (Some 200) |> ignore
+ msg |> globLog.Info (Some 200) |> ignore
List.head moreThanOne |> Ok
/// find footnote in reference list, which contains both footnote and citation
/// returns error msg if foot is not found
diff --git a/FMark/src/Common/Shared.fs b/FMark/src/Common/Shared.fs
index 6d20e19..e150c7f 100644
--- a/FMark/src/Common/Shared.fs
+++ b/FMark/src/Common/Shared.fs
@@ -64,4 +64,3 @@ let replaceChars pat (rep:string) s =
Regex.Replace(s,pat,rep)
let removeWhitespace (s:string) =
s |> removeChars ["\n";"\t";"\r";" "]
-let sharedLog = Logger(LogLevel.WARNING) \ No newline at end of file